OSX strangeness   2 comments

GStreamer under OSX requires setting a couple of environmental variables: DYLD_LIBRARY_PATH and GST_PLUGIN_PATH. One approach I relied on before in order to define these variables was to use the the setenv command in the /etc/launchd.conf file. launchd.conf is read by the launchd service during system boot. But, it turns out that any variable that starts with DYLD is just ignored…

Defining the following /etc/launch.conf file seemed to be enough to let OSX know the location of the gstreamer base libraries (libgstreamer-0.10.0.dylib, etc) and the rest of the gstreamer plugins:

setenv DYLD_LIBRARY_PATH /Library/GStreamer/bin
setenv GST_PLUGIN_PATH /Library/GStreamer/lib/gstreamer-0.10

This used to work for Leopard and at least for Snow Leopard 10.6.1, but seems that is not effective anymore (at least from what I observed in OSX 10.6.2, and other users reported as well). Although GST_PLUGIN_PATH is properly set, DYLD_LIBRARY_PATH is not. Strangely enough, any environmental variable that starts with DYLD will be just ignored. For instance, booting the system with the following /etc/launch.conf file:

setenv DYLD_LIBRARY_PATH /Library/GStreamer/bin
setenv GST_PLUGIN_PATH /Library/GStreamer/lib/gstreamer-0.10
setenv TYLD_123A blah
setenv DYLD_123A blahblah

will result in the variables GST_PLUGIN_PATH and TYLD_123A to be set system wide containing the specified values, while DYLD_LIBRARY_PATH and DYLD_123A being ignored.
Of course, setting system-wide environmental variables such as DYLD_LIBRARY_PATH might not be an advisable practice in any case. It seems that is possible to use local launchd.conf files located inside the users home folder, but I haven’t tried this yet.
At this point I think that the safest solution for this problem consists in setting the environment just for the specific application using gstreamer. This can be done with a simple launch script such as the following:

export DYLD_LIBRARY_PATH=/Library/GStreamer/bin
export GST_PLUGIN_PATH=/Library/GStreamer/lib/gstreamer-0.10


Posted May 12, 2010 by ac in Programming

Tagged with , , ,

2 responses to “OSX strangeness

Subscribe to comments with RSS.

  1. Setting environment variables should be done in ~/.MacOSX/environment.plist I believe. It won’t initially work either for DYLD_* for security reasons, but it can be solved: http://support.apple.com/kb/TA24723

    • Thanks so much for the tip. The workaround described in the link actually indicates that each application has its own info.plist file. Changing this one instead of ~/.MacOSX/environment.plist might be better, I think, since the environmental variables would be set only for the particular app and not for the entire system.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: