Supporting --onefile --icon=name.icns for Mac?

1,337 views
Skip to first unread message

David Cortesi

unread,
Jan 29, 2013, 5:45:36 PM1/29/13
to pyins...@googlegroups.com
To resolve ticket #350 (http://www.pyinstaller.org/ticket/350) you added code to make a Mac OS --onefile bundled app use the pyinstaller icon.

This demonstrates that somebody understood how to apply an icon file to a mac app bundle (add a line in the info.plist and put the .icns file in the Resources folder).

In that case it should be dead simple to actually implement the --icon=myfile.icns option for Mac OS (merely substitute the user's file for the pyinstaller icns file and continue as per ticket #350). But it doesn't have any effect.

I see ticket #237 calling for that function but its status is not clear to me. What is the status of --icon option for mac os?

Thanks,
Dave Cortesi

Martin Zibricky

unread,
Jan 29, 2013, 6:02:20 PM1/29/13
to pyins...@googlegroups.com
David Cortesi píše v Út 29. 01. 2013 v 14:45 -0800:
> In that case it should be dead simple to actually implement the
> --icon=myfile.icns option for Mac OS (merely substitute the user's
> file for the pyinstaller icns file and continue as per ticket #350).
> But it doesn't have any effect.
>
> I see ticket #237 calling for that function but its status is not
> clear to me. What is the status of --icon option for mac os?
>
> Thanks,
> Dave Cortesi

The status is that --icon for mac is not implemented. If you run

./pyinstaller.py --help

you will get
-------------------
-i FILE.ICO or FILE.EXE,ID or FILE.ICNS, --icon=FILE.ICO or FILE.EXE,ID
or FILE.ICNS

If FILE is an .ico file, add the icon to the final executable.
Otherwise, the syntax 'file.exe,id' to extract the icon with the
specified id from file.exe and add it to the final executable. If FILE
is an .icns file, add the icon to the final .app bundle on Mac OS X (for
Mac not yet implemented).

dbv

unread,
May 25, 2013, 9:21:33 AM5/25/13
to pyins...@googlegroups.com
Will the icon support for OSX be available soon('ish)?

Martin Zibricky

unread,
May 27, 2013, 4:23:31 AM5/27/13
to pyins...@googlegroups.com
dbv píše v So 25. 05. 2013 v 06:21 -0700:
> Will the icon support for OSX be available soon('ish)?

It is not in my plan yet.

But you could contribute a patch for it. It should not be hard.

David Cortesi

unread,
May 27, 2013, 11:03:17 AM5/27/13
to pyins...@googlegroups.com
    > Will the icon support for OSX be available soon('ish)? 
    It is not in my plan yet.
    But you could contribute a patch for it. It should not be hard.
Indeed it should not be hard.
Everything about a Mac OS app is described in the info.plist
that is inside Contents inside the app folder.
This is where the path to the icon file is stowed,
as well as other useful characteristics of the app.

Right now PyInstaller drops in a simple info.plist and
its own generic icon file. I believe all that is needed is to
copy in a user-specified icon file instead, and put its
name in the plist.

Unfortunately when I tried to research this I found the
Apple docs on info.plist contents deep and confusing.
But anyone who has had experience building apps for
OS X should be able to do this -- and maybe surface
some other handy info.plist features to the PyInstaller
command line -- quite easily.

Martin Zibricky

unread,
May 27, 2013, 4:48:52 PM5/27/13
to pyins...@googlegroups.com
David Cortesi píše v Po 27. 05. 2013 v 08:03 -0700:
> ight now PyInstaller drops in a simple info.plist and
> its own generic icon file. I believe all that is needed is to
> copy in a user-specified icon file instead, and put its
> name in the plist.

I just looked at the code and it looks like the only thing to implement
is passing icon filename from command line.

Martin Zibricky

unread,
May 28, 2013, 3:25:19 PM5/28/13
to pyins...@googlegroups.com
dbv píše v So 25. 05. 2013 v 06:21 -0700:
> Will the icon support for OSX be available soon('ish)?

Could you please try my branch from
https://github.com/matysek/pyinstaller

I tried to implement --icon for osx.

Thanks.

dbv

unread,
Jun 2, 2013, 5:58:44 PM6/2/13
to pyins...@googlegroups.com
Hi Martin
Tried the --icon for osx but it didn't work.  The .spec file was configured similar to windows using an .ico file.  No error messages were displayed to identify the failure. Best ...

Martin Zibricky

unread,
Jun 3, 2013, 4:33:34 AM6/3/13
to pyins...@googlegroups.com
Have you tried my branch?

https://github.com/matysek/pyinstaller

dbv píše v Ne 02. 06. 2013 v 14:58 -0700:

dbv

unread,
Jun 4, 2013, 12:23:55 PM6/4/13
to pyins...@googlegroups.com
Did try with the "pyinstaller-develop".  Tried again and still no luck.  The file out00-EXE.toc lists the correct path to the icon folder and icon file.

Martin Zibricky

unread,
Jun 4, 2013, 12:44:36 PM6/4/13
to pyins...@googlegroups.com
dbv píše v Út 04. 06. 2013 v 09:23 -0700:
> Did try with the "pyinstaller-develop". Tried again and still no
> luck. The file out00-EXE.toc lists the correct path to the icon
> folder and icon file.

Then let's get back to the way how you create your app.

Pyinstaller should create a spec file with 'BUNDLE' section and there
should be 'icon' with path to your icon.

Martin Zibricky

unread,
Jun 4, 2013, 12:45:57 PM6/4/13
to pyins...@googlegroups.com
dbv píše v Út 04. 06. 2013 v 09:23 -0700:
> Did try with the "pyinstaller-develop". Tried again and still no
> luck. The file out00-EXE.toc lists the correct path to the icon
> folder and icon file.

You should try with my develop. If it works for you then I will merge it
to 'pyinstaller-develop'.

dbv

unread,
Jun 8, 2013, 8:24:22 AM6/8/13
to pyins...@googlegroups.com
Your pyinstaller-develop version is always used.  

For both Windows and OSX, the out00-EXE.toc files point to the .ico path and to the icon file.  But, the OSX executable doesn't get attached with the icon.

Martin Zibricky

unread,
Jun 8, 2013, 4:12:50 PM6/8/13
to pyins...@googlegroups.com
dbv píše v So 08. 06. 2013 v 05:24 -0700:
> Your pyinstaller-develop version is always used.

How do you get my pyinstaller tree?

How do you run pyinstaller? With what options? With the supplied .spec
file or with you main script?

What do you expect to happen with the --icon option on osx?

dbv

unread,
Jun 11, 2013, 1:18:43 PM6/11/13
to pyins...@googlegroups.com
This would have been a nice-to-have.  Apart from the Linux lsb issue, PyInstaller has worked out really well for our project.  Many thanks!

Martin Zibricky

unread,
Jun 11, 2013, 8:03:11 PM6/11/13
to pyins...@googlegroups.com
dbv píše v Út 11. 06. 2013 v 10:18 -0700:
> This would have been a nice-to-have.

The --icon option works for osx and the code is merged.

> Apart from the Linux lsb issue, PyInstaller has worked out really well
> for our project. Many thanks!

What lsb issue are you referring to?

dbv

unread,
Jun 12, 2013, 3:28:46 AM6/12/13
to pyins...@googlegroups.com
The glibc issue mentioned in a previous post.  Just started looking at myppy.  Best ...
Reply all
Reply to author
Forward
0 new messages