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

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.

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.

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"

Related

Mac OSx 7zcat command not found

I am trying to execute a Makefile script and my Mac complains about 7zcat, although I already have 7z installed.
/bin/sh: 7zcat: command not found
Any thoughts on what's missing on my system? Thank you!
I have never used 7zcat before.
However, it looks like it needs to be installed on your system.
https://github.com/essentialkaos/7zcat
Also, after you download install 7zcat you have to give it execute permission with chmod. Finally, you have to execute it by calling its full path for example if you installed it to the directory you are in you would run ./7zcat file.7z or you would add the path to the file to your environment's $PATH variable.
I hope this helps. You might have to do some more research though.
When you open a Terminal window and type 7zcat and hit enter, what happens? Same message? Well, if you cannot use it, why should make be able to use it? Where and how have you installed 7z? Is the folder with the 7z binaries in your PATH? Since if it isn't, of course the command won't be found.
When the system shall run a command, it will search for this command in the directories stored in the PATH variable. Execute echo $PATH in terminal and you will get a colon separated list of directories; only these directories are searched for binaries. So either you must move your binaries to one of these (or put a symlink to one of these) or add the directory with these binaries to the PATH.
Yet there is no official 7z command line installer for MacOS, which brings me back to the original questions "Where and how have you installed 7z?" And are you sure that whatever you installed even includes a 7zcat?

MAC 10.10 Yosemite - Terminal: - bash: [SomeCommand] command not found?

I dont know why but when I write any commands in my terminal. It always show me -bash:[SomeCommand] command not found. I dont know if it's about my path -bash: /user/local/php5/bin:/user/local/mysql/bin: No such file or directory or anything else. It was my first time that I use the terminal and I don't know what happened.
You are missing the regular bin directories. Here's what my $PATH looks like on a fresh Yosemite:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

OS X - Make returning "Nothing to be done for <filename>"

First of all, I would like to apologize if I'm on the wrong stackexchange network, and secondly, sorry if I'm overlooking something simple.
I was moving files from my old hard drive from an old PC when I came across several password protected ZIP Files. However, since those files were a bit old, I forgot the passwords already. I tried every password I could come up with but I still came up empty. After several google searches, I found this tool/utility for Mac OS X that could help me. So I go to the downloads page and download the Mac OSX utility tool and the source code.
However, I am having problems executing the make command for the file. It says on the downloads page:
If you are using linux or another unix, you need to download the source code, uncompress it and type "make" to compile the utility.
So far, what I've tried is
$make /Users/myname/Downloads/aapr-0.01-source/Makefile
I have also tried the other files in the source folder but nothing worked. After that, I'm pretty much blank. I tried double clicking the aapr file in the utility download for Mac (which is a Unix Executable) and it opens a new terminal window displaying the commands and such. Also, doing $aapr [options] [filename] only shows me -bash: aapr: command not found. I also updated XCodes command line tools.
Sorry if I'm missing out on something very basic, I don't usually use the terminal on the OS X.
Try running
cd /Users/myname/Downloads/aapr-0.01-source
make
A Makefile contains rules for building files from other files but it is based on paths and contents, etc. which depend on your current location. So generally you need to be in the directory of the project for it to work.
Edit (copied from my comment):
To execute a command from a specific location (that isn't in the normal $PATH) you need to specify a path for it. So something like /bin/bash or ./aapr (where ./ means the current directory).

terminal displays localhost before username osx

I'm working on getting GIT installed so starting to use my terminal more.
Noticed something odd though. The word localhost:~ before my username
so localhost:~ username$
Is this something I need to be worried about? Just I'm following some tutorials and all of them so far just have the user name like
username$
Done a bit of searching and found nothing on this so far and just wanted to check before I move on any further.
Thanks
using osx 10.8.5
Nothing to worry about. localhost is the name of your machine, followed by :, followed by the directory you're in, in this case ~, which is your home directory.

Can't create a symbolic link with Textmate in Terminal. (mate: command not found)

I'm currently going through http://ruby.railstutorial.org/ and it uses the command "mate" to access Textmate through the terminal. I have had Textmate on my Macbook Air (Lion OS) since I first bought it, but when I try to use a command like "mate .gitignore" the terminal gives me "mate: command not found".
I've looked through all other StackOverflow questions regarding this topic and have done the following:
Attempted to create a symbolic link through the terminal with this code.
$ sudo ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/bin
This code lets me enter my password and tells me the file exists, but still does not allow me to use the "mate" command.
Accessed Textmate/Help/Terminal Usage and tried to create a link for /usr/bin only for it to say operation not permitted.
Used alias mate='open -a textmate'. This works; however, I have to do it every time I open Terminal.
So, my question is can anyone tell me what is wrong? Love to figure this out!
Thank you!
First, you should not add anything to /usr/bin. You should add it into /usr/local/bin. Further, getting the message "file already exists" from ln means that it did not create the link. Try this:
ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate /usr/local/bin/mate
Depending on your current setup, this may have to be run with sudo. In general, if you don't know whether to run something with sudo or not, try without first and see if you get a permissions error, then use sudo.
The best way to do it is from TextMate -> preferences -> Terminal and then check install
all the previous methods didn't work for me.

Resources