OS X Lion, Inkscape 0.48.2, command line fix

This is NOT a support forum. You are welcome to discuss software issues here, but all issues should be reported on Launchpad if you want them fixed.
2muchcoffeeman
Posts: 2
Joined: Wed Mar 07, 2012 2:59 pm

OS X Lion, Inkscape 0.48.2, command line fix

Postby 2muchcoffeeman » Wed Mar 07, 2012 3:09 pm

I had been googling for ages but could not find anything. In the end I had a whack at fixing it my self.

My use case is: Creating SVG files in another vector program, in this case Inkpad on the iPad, opening for tweaking in Inkscape, and using the command line tool to generate pngs.

The command line was giving me errors (below). A bunch of symlinks to the Inkscape package fixed it (the first 2 are for convenience):

Code: Select all

sudo ln -s /Applications/Inkscape.app/Contents/Resources/bin/inkscape inkscape
sudo ln -s /Applications/Inkscape.app/Contents/Resources/bin/inkscape-bin inkscape-bin
sudo ln -s /Applications/Inkscape.app/Contents/Resources/etc /usr/local/etc
sudo ln -s /Applications/Inkscape.app/Contents/Resources/themes/ /usr/local/themes
sudo ln -s /Applications/Inkscape.app/Contents/Resources/lib/gnome-vfs-2.0 /usr/local/lib/gnome-vfs-2.0


May this help others!

Stuff it was spitting out:

sed: /Users/myuser/themes/Clearlooks-Quicksilver-OSX/gtk-2.0/pre_gtkrc: No such file or directory
Setting Language: .UTF-8
sed: /Users/myuser/etc/pango/pangorc: No such file or directory
sed: /Users/myuser/etc/pango/pango.modules: No such file or directory
cp: /Users/myuser/etc/pango/pangox.aliases: No such file or directory
sed: /Users/myuser/etc/gtk-2.0/gtk.immodules: No such file or directory
sed: /Users/myuser/etc/gtk-2.0/gdk-pixbuf.loaders: No such file or directory

(process:53165): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.

(inkscape-bin:53165): libgnomevfs-CRITICAL **: gnome_vfs_uri_is_local: assertion `uri != NULL' failed

** (inkscape-bin:53165): WARNING **: Invalid URI

** (inkscape-bin:53165): WARNING **: Error: Could not open file 'Bookmark.png' with VFS

(inkscape-bin:53165): libgnomevfs-CRITICAL **: gnome_vfs_uri_is_local: assertion `uri != NULL' failed

** (inkscape-bin:53165): WARNING **: Invalid URI

** (inkscape-bin:53165): WARNING **: Error: Could not open file 'Bookmark.png' with VFS

** (inkscape-bin:53165): WARNING **: Specified document Bookmark.png cannot be opened (does not exist or not a valid SVG file)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: OS X Lion, Inkscape 0.48.2, command line fix

Postby ~suv » Wed Mar 07, 2012 6:07 pm

Here's the recommended way to use the inkscape binary from inside the OS X application bundle on the command line (or from within scripts):

Code: Select all

/Applications/Inkscape.app/Contents/Resources/script "/path/to/myfile.svg" --export-png="/path/to/outputfile.png"

That's all - no additional links or anything else required: just keep in mind to use the full path to reference the script, as well as any input and output files (NOTE: relative path names will not work).

For additional information about other command line options, use

Code: Select all

/Applications/Inkscape.app/Contents/Resources/script --help

[added later]
If you use a command line option which needs to open the GUI (any verb for example) you might still encounter some other console warnings about LANG and possibly about certain theme settings from the bundled gtkrc file - they are harmless, known and being worked on.
[/added later]


<opinion>
Personally I would strongly recommend to remove the links you made in '/usr/local/' [1] in an effort to invent a complicated workaround and use the method described above.

Please do keep in mind that bundling a software ported from unix/linux to Mac OS X is done because Mac users normally want a clickable, fully relocatable Inkscape.app which by nature makes it harder to use the inkscape binary itself (inkscape-bin) without the infrastructure implied in such an application bundle. Advanced users who mainly need to use Inkscape in scripts or on the command line, in the end might be better off to install Inkscape via MacPorts themselves for such purposes.

[1] as well as those elsewhere "for convenience" - not sure where you even linked inkscape and inkscape-bin to, requiring 'sudo' for $HOME or $HOME/bin? I would refrain from publishing such incomplete instructions involving 'sudo' commands in a user forum.
</opinion>

2muchcoffeeman
Posts: 2
Joined: Wed Mar 07, 2012 2:59 pm

Re: OS X Lion, Inkscape 0.48.2, command line fix

Postby 2muchcoffeeman » Wed Mar 07, 2012 7:50 pm

Ah, good tip! Much easier to just create an alias to that!

spaelti
Posts: 12
Joined: Tue May 22, 2012 7:18 pm

Re: OS X Lion, Inkscape 0.48.2, command line fix

Postby spaelti » Mon May 28, 2012 1:36 pm

I have tried the method suggested by ~suv, but I still get the following error message every time:

Setting Language: .UTF-8

(process:830): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: OS X Lion, Inkscape 0.48.2, command line fix

Postby ~suv » Mon May 28, 2012 5:43 pm

spaelti wrote:I have tried the method suggested by ~suv, but I still get the following error message every time:

Setting Language: .UTF-8

(process:830): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.

This message usually does no harm - it's just a warning (it's a known issue that the current tests in the launcher script of Inkscape's Mac OS X package to detect the OS X user language settings often fails, depending on the system configuration).

If it still causes certain python scripts to bail out with an error (see for example bug #406662, comments #3 ff), you can hard-code the language in 'Inkscape.app/Contents/Resources/bin/inkscape' as mentioned in the comments of that bug report: insert this line

Code: Select all

export LANG="en_US.UTF-8"
(or whatever locale you prefer) before the line 128

Code: Select all

echo "Setting Language: $LANG" 1>&2


Return to “Discuss Software Issues”