macos 如何设置 OS X 终端的默认主页?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/145321/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 05:55:43  来源:igfitidea点击:

How to set OS X Terminal's default home?

macosterminalbootcamp

提问by Mac

For some reason after I installed Boot Camp, my os x terminal started to point to the Boot Camp drive instead of my os x home directory by default! Once in the terminal I know how to switch back an forth and am able to do that, but I was wondering how to make my terminal default back to my os x home folder?

出于某种原因,在我安装 Boot Camp 后,我的 os x 终端默认开始指向 Boot Camp 驱动器而不是我的 os x 主目录!进入终端后,我知道如何来回切换并且能够做到这一点,但我想知道如何让我的终端默认回到我的 os x 主文件夹?

I've checked my Home Directory under System Preferences->Accounts->Control-click on my account and it is pointing to the right place. I've also tried unmounting it with no luck.

我已经在系统偏好设置-> 帐户-> 控制下检查了我的主目录,点击我的帐户,它指向正确的位置。我也试过卸载它但没有运气。

采纳答案by Kendall Helmstetter Gelner

You probably want these instructions for how to use the command line:

您可能需要以下有关如何使用命令行的说明:

https://superuser.com/questions/154193/setting-a-users-home-directory-on-mac-os-x-server-from-the-command-line

https://superuser.com/questions/154193/setting-a-users-home-directory-on-mac-os-x-server-from-the-command-line

Basically, use the dsclcommand line tool to see what the system thinks your home directory is set to, or to try and reset it....

基本上,使用dscl命令行工具查看系统认为您的主目录设置为什么,或者尝试重置它....

回答by Thorsten79

This is a bit of under-the-hood fiddling, but you could simply enter

这有点在幕后摆弄,但你可以简单地输入

cd <directory>

in /Users/<yourUserName>/.profile

and startup a new terminal. You should then be in the directory you want.

并启动一个新终端。然后你应该在你想要的目录中。