Reputation: 4558
I have an issue regarding installation of a command line application to mac. So the issue is that i have an application (or rather a function), written in c++ that I want to run from the command line. I want to run the application as
myapp <input>
and it is supposed to give a printout (which it does). This is supposed to work, independent of my current directory. Since, as far as I know, it is recommended to use a bundle, or a dmg for more complicated applications and the application I have now is compiled to a single .exe file, I will keep things simple. How to install a compiled command line application on my Mac? So to say, where am I supposed to place the file? I suppose this is a fairly basic questions, but all questions about "how to install command line tools for xcode?" makes it hard to find an answer.
Upvotes: 0
Views: 3087
Reputation: 66459
Command line applications are searched for in the locations in the environment variable "PATH", like on other Unixes.
They don't really need "installation" of a more advanced kind than "stick it somewhere along the $PATH".
(You can try echo $PATH
in your terminal to see its contents; it's a colon-separated list of directory paths.)
I keep a directory called "bin" in my home directory where I put my personal projects (it's considered bad practice to add applications somewhere along the system's path, except possibly in /usr/local/bin).
Then, in ~/.bash_profile
, I add
export PATH="$HOME/bin:$PATH
and I "install" like this:
cp my_exe $HOME/bin
(There is an overwhelming amount of information about Unix on the internet, and a lot of it applies to a Mac.)
Upvotes: 3