Mophilly
Mophilly

Reputation: 143

mac osx 10.7 install script error: "~/Library/" not found

I use a bash script to install an app on Mac OS X "Lion". First I copy the app bundle into place, then attempt to install postgres into the app bundle. The data path for the postgres db needs to be in "~/Library/Application Support/myappfolder/data/".

Now the problem (appears to be) that the script stumbles because the OS says the path is not found. Backing up the path names I get to "~/Library/" and it still fails. The script is run with admin privileges.

To put this another way, from the terminal, this works:

   me: cd ~/Library

but this does not:

   me: mydir="~/Library/"
   me: cd $mydir

I know things have changed in 10.7, but I haven't found the answer at the dev center yet.

Upvotes: 0

Views: 280

Answers (2)

Ernest Friedman-Hill
Ernest Friedman-Hill

Reputation: 81684

This actually doesn't work in 10.5, either, so I don't think it's a Lion specific problem. Something like this will always work, though:

eval "cd $mydir"

Upvotes: 1

Matt Solnit
Matt Solnit

Reputation: 33544

I don't think this is Lion-specific. When you use quote marks, you are causing the ~ character to be treated literally, instead of as an alias for $HOME. So it's looking for an actual directory with a tilde in the name, which doesn't exist.

Try using mydir="$HOME/Library" instead to see if that fixes the problem.

Upvotes: 1

Related Questions