Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Run Terminal as Administrator on Mac Pro

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?

like image 515
jmoneilthe2 Avatar asked Jul 29 '15 12:07

jmoneilthe2


People also ask

How do I open Mac Terminal as administrator?

To run commands with superuser privileges, use the sudo command. sudo stands for superuser do. You're asked for the password of the current user. You're asked to enter the password for adminUsername, after which a new shell is opened for that user.

Can you run things as administrator on Mac?

You must be an administrator or root user, also called superuser, to execute many of the commands used to manage a server. This is because the shutdown command can be run only by the root user or by an administrator user with root user privileges.


6 Answers

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
like image 193
deceze Avatar answered Sep 28 '22 03:09

deceze


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.

like image 36
Aditya Kadakia Avatar answered Sep 25 '22 03:09

Aditya Kadakia


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
like image 20
Bhaskara Arani Avatar answered Sep 26 '22 03:09

Bhaskara Arani


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
like image 31
94230 Avatar answered Sep 26 '22 03:09

94230


Add sudo to your command line, like:

$ sudo firebase init
like image 24
Pedro Henrique Arthur Avatar answered Sep 24 '22 03:09

Pedro Henrique Arthur


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.

like image 22
user9091797 Avatar answered Sep 27 '22 03:09

user9091797