如何配置OSX系统下Hyper.is终端默认启动至桌面目录?
Absolutely! You can easily configure Hyper.is to launch directly into your Desktop folder instead of the root directory on macOS. Here's a straightforward step-by-step guide:
Step 1: Open Hyper's Configuration File
- The fastest way is to use the keyboard shortcut
Cmd + ,while Hyper is open—this will bring up the.hyper.jsconfig file in your default editor. - Alternatively, you can manually locate the file in your user directory (
~/.hyper.js). If you don't see hidden files, pressCmd + Shift + .in Finder to reveal them.
Step 2: Add/Modify the workingDirectory Setting
In the config section of the .hyper.js file, look for the workingDirectory key. If it doesn't exist, add it to the config object. Use this universal path that works for any macOS user:
module.exports = { config: { // ... keep all your existing config options here workingDirectory: `${process.env.HOME}/Desktop`, // ... keep other config options here }, // ... rest of the config file };
This uses the HOME environment variable to dynamically point to your user folder, so you don't have to hardcode your username.
Step 3: Save and Restart Hyper
Save the changes to .hyper.js, then close and reopen Hyper. You'll now land directly in your Desktop directory every time you launch the app.
Alternative: Shell Configuration (If You Prefer)
If you want this behavior across all terminal instances (not just Hyper), you can add cd ~/Desktop to your shell's startup file:
- For zsh (default on newer macOS versions), edit
~/.zshrc - For bash, edit
~/.bash_profileor~/.bashrc
Add the linecd ~/Desktopat the end, save, and restart your terminal. Note this will affect all terminal apps, not just Hyper.
内容的提问来源于stack exchange,提问作者Josh Pittman

