bash: id command not found

when I issue id command in Terminal on my iMac or my Macbook Air I get something like this (MacBook air):


User-MacBook-Air:~ user$ id

uid=502(user) gid=20(staff) groups=20(staff),12(everyone),33(_appstore),61(localaccounts),79(_appserverusr) ,80(admin),81(_appserveradm),98(_lpadmin),100(_lpoperator),204(_developer),401(c om.apple.access_screensharing)

user-MacBook-Air:~ user$


But in my MacBook Pro:


Oryx:~ user$ id

-bash: id: command not found

Oryx:~ user$


both have ML10.8.2 installed.


This problem is causing some applications not to recognize an admin.








iMac, OS X Mountain Lion (10.8.2)

Posted on Dec 13, 2012 9:58 AM

Reply
7 replies

Dec 13, 2012 2:37 PM in response to alkhater

In the Mac OS X (including Mountain Lion) operating system, executable system commands are stored in specific filesystem locations. The PATH environment variable indicates the order that that these system locations are searched. The id(1) command that bash (on the MacBook Pro) could not find, is located in the filesystem location: /usr/bin.


When your bash script, on your MacBook Pro indicated that it could not find /usr/bin/id, it meant that the bash shell did not know how to search for id. Unless you specifically deleted /usr/bin/id, it remains on your system, as part of the standard installation.


You can look for “/usr/bin/id,” (without the quotes or comma) in Spotlight. Or, you can launch the Terminal application by pressing Command+Shift+U, and double clicking the Terminal icon. Type only the bold text at the terminal prompt.


which id

/usr/bin/id


id

Returns information about your user id, group, and groups affiliation


If the which command produces the above output, the id command is on your MacBook Pro and the problem is inherent to your shell script.


Exit the Terminal application. Post back here with the above results.

Dec 13, 2012 3:19 PM in response to alkhater

The correct Terminal command that you needed to run after copying id back into your MacBook Pro is the following:

sudo chmod 755 /usr/bin/id && sudo chown root:wheel /usr/bin/id

This is a privileged, compound command that sets the file permission on id, and if that was successful, it then sets the ownership to root wheel. The sudo command will prompt you for your login password, but will not echo anything to the terminal as you type your password.

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.

bash: id command not found

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