How to Run Terminal as Administrator on Mac Pro

node.jsGitMacosCordova

node.js Problem Overview


I am using a Mac for the first time and need to run Terminal as an admin. I have installed NodeJs and Git and want to download Phone Gap/Corova but when I try to install Cordova, it comes back with an error saying I should be an admin when running the terminal. How do I open a command prompt in terminal as an admin to the Mac Pro?

node.js Solutions


Solution 1 - node.js

This is not Windows, you do not "run the Terminal as admin". What you do is you run commands in the terminal as admin, typically using sudo:

$ sudo some command here

Solution 2 - node.js

To switch to root so that all subsequent commands are executed with high privileges instead of using sudo before each command use following command and then provide the password when prompted.

sudo -i

User will change and remain root until you close the terminal. Execute exit commmand which will change the user back to original user without closing terminal.

Solution 3 - node.js

search for terminal after opening the termincal type

su <admin-user-name>   //su - switch user

enter and then give the admin password then run your sudo commands e.g:

sudo open MySQLWorkbench.app

Solution 4 - node.js

You can run a command as admin using

sudo <command>

You can also switch to root and every command will be run as root

sudo su

Solution 5 - node.js

Add sudo to your command line, like:

$ sudo firebase init

Solution 6 - node.js

sudo dscl . -create /Users/joeadmin
sudo dscl . -create /Users/joeadmin UserShell /bin/bash
sudo dscl . -create /Users/joeadmin RealName "Joe Admin" 
sudo dscl . -create /Users/joeadmin UniqueID "510"
sudo dscl . -create /Users/joeadmin PrimaryGroupID 20
sudo dscl . -create /Users/joeadmin NFSHomeDirectory /Users/joeadmin
sudo dscl . -passwd /Users/joeadmin password 
sudo dscl . -append /Groups/admin GroupMembership joeadmin

press enter after every sentence

Then do a:

sudo reboot

Change joeadmin to whatever you want, but it has to be the same all the way through. You can also put a password of your choice after password.

Solution 7 - node.js

I faced the same problem, later I came to know I need to switch user(using su command) to an admin user. After entering the password, I was able to execute the command successfully.

MGCXXXXXXXXD6N:~ username$ su <admin_user> 
Password: ******
bash-3.2$ _________Give your command here. It works_________________

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionjmoneilthe2View Question on Stackoverflow
Solution 1 - node.jsdecezeView Answer on Stackoverflow
Solution 2 - node.jsAditya KadakiaView Answer on Stackoverflow
Solution 3 - node.jsBhaskara AraniView Answer on Stackoverflow
Solution 4 - node.js94230View Answer on Stackoverflow
Solution 5 - node.jsPedro Henrique ArthurView Answer on Stackoverflow
Solution 6 - node.jsuser9091797View Answer on Stackoverflow
Solution 7 - node.jsJeberdson AbrahamView Answer on Stackoverflow