# Installing Unix command line tool to OSX



## toolman (Mar 20, 2003)

Hello...

I'm new to this, and I've been trying to install a unix command line tool written in C in OSX.

It includes a makefile, and it compiles without errors, but when I want to use it in a terminal window, it tells me that the command was not found.

So maybe it's because I didnt copy the bin to the proper directory, or used the right permission, I don't know, but How do you usually port a unix c program to OSX??

Following is what I did in detail:

The command line tool is ChordPro.... a guitar chord utility... it can be downloaded from http://public.planetmirror.com/pub/olga/chordpro/Programs/CHORD3.6.tar.gz

I Untared it, and modified the makefile to:

.
.
.
# where to put the resulting program
BINDIR = /usr/local/bin

# where to put the man page
MANDIR = /usr/local/share/man
MANEXT = 1

.
.

leaving the rest untouched

than in terminal window :

make
make install

I even tried:
sudo su
make
make install

the tool is compiled, copied to usr/local/bin
but if I call for it, it doesn't work... even the man doesn't work...

what did I do wrong??

I created a project with Project Builder, compiled and run it from Project Builder, and it worked, but as a standalone command line tool from the terminal... nada

thanks for helping me improving my unix porting skills.... and hopefully even my guitar repertoire...


----------



## shadowfax (Mar 20, 2003)

have you download the dev tools from the apple's website, I think it comes with the make utility, hope this helps.


----------



## rhg (Mar 20, 2003)

The cause is probably that both /usr/local/bin and the current directory are not part of your PATH (by default they are not).

So just  invoke your program by either giving the full qualified path (/usr/local/bin/ChordPro instead of just ChordPro) or - in case /usr/local/bin is the current directory - ./ChordPro

You can modify the PATH and set an appropriate MANPATH in your /etc/profile or ~/.cshrc (or ~/.bashrc if you're using the bash shell). Alternatively, you can create the ~/.MacOSX/environment.plist file and set PATH and MANPATH therein (which will affect all your Mac OSX and terminal  and X11 environments).


----------



## rhg (Mar 20, 2003)

Follow-ups:

a) It is however not recommended to include the current directory '.' in your PATH for security reasons.

b) After creating/modifying ~/.MacOSX/environment.plist you are required to log out and log in again.


----------



## toolman (Mar 21, 2003)

Thanks RHG

it works with the full path... you are right...

now i modified my etc/profile to add the path, but it didn't work

so i tried to find the .cshrc file but didn't find it (excuse my ignorance but ) where is it supposed to be??

same with ~/.MacOSX/environment.plist

I guess I have to be #root to access those files, so I was 

thanks again!


----------



## wyvern (Mar 21, 2003)

if you are using tcsh: modify ~/.tcshrc

If you are using bash: modify ~/.bashrc or /etc/profile

Open a new terminal window and it will use the new settings.


----------

