A collection of computer systems and programming tips that you may find useful.
 
Brought to you by Craic Computing LLC, a bioinformatics consulting company.

Showing posts with label 'mac os x'. Show all posts
Showing posts with label 'mac os x'. Show all posts

Monday, October 11, 2010

/etc/paths.d as a way to configure Paths in Mac OS X

Just found out about a simple way to manage paths to installed software in Mac OS X

As well as, or instead of, setting PATH environment variables in startup files, you can simply add a path as a file to the directory /etc/paths.d

For example, here is a command that sets up a path to a custom installation of MongoDB

$ sudo sh -c 'echo "/Users/jones/Documents/mypath/mongodb/bin" > /etc/paths.d/mongodb'

Start up a new shell and you will find that path added to your PATH environment variable.

Note that this is a system wide setting and so it gets set early in the process of shell creation. If you need to override PATH settings for specific users then you still need to set paths in .bashrc, etc. I don't know the order in which /etc/path.d files are sourced but I would assume alphabetical.

Also note that you need the 'sh -c ' construct in order to create the file as shown above. Simple 'sudo echo' will not work.


 

Tuesday, May 11, 2010

Compiling Ghostscript on Intel 64 bit Mac OS X

Ran into problems getting Ghostscript to compile on an Intel Mac running Snow Leopard.

The error messages were telling me it was trying to compile a 32 executable, and then after fixing that it complained that libraries in /opt/local/lib were compiled for 32 bit. The thing is, except for some old mac ports stuff, I don't use /opt/local!

I was able to fix compile successfully with three steps.

1: Take the old /opt/local/lib code out of the picture by renaming the directory to a temporary name. I can bring it back if it turns out something actually relies on it.

2: Rub ./configure with CFLAGS and LDFLAGS defined. These end up getting passed to 'make'
$ ./configure CFLAGS='-arch x86_64' LDFLAGS='-arch x86_64'


3: Compile it 'make' (with no flags) and install with 'sudo make install'

Not sure yet if it can pick up all the fonts that it needs - we'll soon see...


 

Archive of Tips