node.js 如何在 Mac Pro 上以管理员身份运行终端
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31700746/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Run Terminal as Administrator on Mac Pro
提问by jmoneilthe2
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?
我第一次使用 Mac,需要以管理员身份运行终端。我已经安装了 NodeJs 和 Git 并想下载 Phone Gap/Corova,但是当我尝试安装 Cordova 时,它返回一个错误,提示我在运行终端时应该是管理员。如何以 Mac Pro 的管理员身份在终端中打开命令提示符?
回答by deceze
回答by Aditya Kadakia
To switch to root so that all subsequent commands are executed with high privileges instead of using sudobefore each command use following command and then provide the password when prompted.
要切换到 root 以便以高权限执行所有后续命令,而不是sudo在每个命令之前使用,请使用以下命令,然后在出现提示时提供密码。
sudo -i
sudo -i
User will change and remain root until you close the terminal. Execute exitcommmand which will change the user back to original user without closing terminal.
用户将更改并保持 root 身份,直到您关闭终端。exit在不关闭终端的情况下执行将用户更改回原始用户的命令。
回答by Bhaskara Arani
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 命令,例如:
sudo open MySQLWorkbench.app
回答by 94230
You can run a command as admin using
您可以使用管理员身份运行命令
sudo <command>
You can also switch to root and every command will be run as root
您也可以切换到 root,每个命令都将以 root 身份运行
sudo su
回答by Pedro Miranda
Add sudoto your command line, like:
将sudo添加到命令行,例如:
$ sudo firebase init
回答by user9091797
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.
将 joeadmin 更改为您想要的任何内容,但必须始终相同。您也可以在密码后放置您选择的密码。

