Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 01-29-2002, 01:13 AM   #1
cOle2
Prospect
 
Join Date: Jan 2002
Posts: 3
How do I make a CLI app executable from everywhere

I have an app that I've compiled and I want to be able to run it from anywhere instead of having to cd to the program directory.

I'm not quite sure what I have to do. Can anyone shed some light on this for me?
cOle2 is offline   Reply With Quote
Old 01-29-2002, 01:34 AM   #2
mervTormel
League Commissioner
 
Join Date: Jan 2002
Posts: 5,536
so, you've compiled source, made object code, and linked it and now have an executable?

did you use project builder, or just the command line compiler/linker?

i think you might have a ways to go to make it a double-clickable OSX app.

let us know some more details about making this 'app'
mervTormel is offline   Reply With Quote
Old 01-29-2002, 03:46 AM   #3
pmccann
Major Leaguer
 
Join Date: Jan 2002
Location: Adelaide, South Australia
Posts: 470
Throw it in your path

Hi,

As long as the thing is executable (which, from your post, seems OK), and is visible to your shell through the PATH variable (that is, the executable sits in the top level of one of the directories listed when you enter "printenv PATH") then you should just be able to type the name, no matter what directory you're currently in.

eg Make a "bin" directory in your home directory if there's not one there already. Move your executable to that location. Type the word "rehash" to get the shell to scan through all of the directories in your PATH looking for executables to cache. (It does this when it starts up, and thus won't see anything added into the directories until you request a rescan this way.) And, well.... bingo.

If you don't want to, or can't move the thing, you can just add the directory in which the executable sits to your path. If it's in /this/funky/dir you can add this line to the end of your ~/.tcshrc or ~/.cshrc file (whichever you have: make one of them if you don't have one. Damn this was supposed to be short!).

setenv PATH ${PATH}:/this/funky/dir

Cheers,
Paul
pmccann is offline   Reply With Quote
Old 01-31-2002, 12:04 AM   #4
cOle2
Prospect
 
Join Date: Jan 2002
Posts: 3
Adding my programs directory to the path via my .tcshrc file worked beautifully.

Thanks for the help!
cOle2 is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 11:58 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.