Installing new library commands within Mac OS X Terminal

Hello,


I would like to know how can I install new library commands within the Mac OS X Terminal.


Can anyone provide me some instructions on how to do that task?


John P.

MacBook Pro, Mac OS X (10.6.8)

Posted on Sep 2, 2014 5:35 AM

Reply
6 replies

Jan 23, 2015 5:22 AM in response to JohnDB3975

What are you actually trying to achieve? The shell scripting & command line topic is quite broad. It sounds like you are interested in setting up user environments, but I really can't get to grips with your final aim.



The manuals document the commands.

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/ man5/manpages.5.html#//apple_ref/doc/man…


Bwana can make reading the installed in manuals easier…

http://bruji.com/bwana/

Install it & then type 'man://chmod' into Safari to view the docs in the browser.


Apple have an in depth shell scripting primer…

https://developer.apple.com/library/mac/documentation/OpenSource/Conceptual/Shel lScripting/Introduction/Introduction.htm…


O'reilly cover an awful lot of shell & other programming/ coding topics…

http://search.oreilly.com/?q=shell&x=0&y=0

Sep 6, 2014 8:09 AM in response to JohnDB3975

Mac OS is Unix - so it's basically up to you to decide where you want to install command line tools.


You will need to understand that the command line tools will use a 'search path' to look for the executable code for the commands issued in the Terminal or in scripts etc.


In Terminal…

echo $PATH

Will output something like… (this is NOT the default search path).

-> /bin:/sbin:/usr/X11/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/ usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin


Which means the OS will look in each of those places for any command I run starting on the left (the colon is a separator). Bear in mind each user has their own search $PATH, this can be configured in the users profile (the ~/.bash_profile, ~/.bashrc and many other config files for other environments).


You can see where tools are installed via the 'which' command…

which echo ping

-> /bin/echo

-> /sbin/ping


Those locations are considered 'system' folders. In practice you will probably install into /usr/local/bin for any tools that you compile yourself. Compiled tools have arguments that can allow you to specify where it should be installed when you make the code.


Needless to say this is a complex thing to discuss, if you can be specific about what you hope to install that may help, otherwise we are left to point out vague generalities that may send you down the wrong path. What are you actually aiming to install & does it require compilation etc?


In general I'd avoid adding items to /bin, /sbin, /usr/bin, /usr/sbin , these are considered Apple's locations - software update will overwrite them. Stick with /usr/local as the location for third party tools.


Or you can create your own folder for commands/ scripts in your home folder & then add the path to the $PATH variable.


(Please excuse the lack of formatting - this forum is refusing access to the 'advanced editor' to make the code look cleaner).

Jan 21, 2015 7:15 AM in response to Drew Reece

The command that I want to install within the Unix kernel files and folders is the mkudffs - the command library that permits users to create and customize their permissions whether they are configured further via chmod or chroot commands - the two of them that either grant or revoke permissions for users.


Now about the 'advanced editor', I may have concluded that it is proprietary within the Mac OS X Terminal and X11 console.


Now a response to creating my own folder for commands/scripts in the home folder and adding the $PATH variable to it:


I am not sure on how I can easily specify a $PATH variable reference to a command: for example: mkudffs - the command that permits users create and customize their own UDF file system and is probably further considered configurable via chmod or chroot commands, which is explained above in the first paragraph.


JohnDB3975

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Installing new library commands within Mac OS X Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.