Hyper: zshrc not read if symlinked

Created on 17 Mar 2020  路  12Comments  路  Source: vercel/hyper

  • [x] I am on the latest Hyper.app version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate

Issue


Hi,

I have my dotfiles synced across multiple devices and because of that they are not "physically" in the home directory, but are symlinked instead. When I'm opening a hyper terminal there is a fresh-install zsh prompt instead of my customized oh-my-zsh prompt. There are no errors in the console, it's just not being read. LMK if I can provide more info.

Most helpful comment

@sbrych I note that you're on Catalina. It sounds like you may be hitting the new access controls. I'd recommend adding Hyper.app under System Preferences > Security & Privacy > Full Disk Access and try to reproduce again. You'll need to exit and restart Hyper after adding it to Full Disk Access.

All 12 comments

Does it work in the default terminal? Also I see that you are using /usr/local/bin/zsh, any specific reason for that over /bin/zsh?

ping @sbrych

I'm sorry @LabhanshAgrawal. I typed the response, changed the tab and forgot to actually send it, so here it goes:

  • Yes, it works in terminal, iterm2 and alacritty.
  • I am using the zsh version (5.8) installed via homebrew, that's why it's in /usr/local/bin instead of just /bin. However, for testing purposes I changed it to /bin/zsh (also changed it in the .hyper.js file), but it didn't help. The weird thing happened, though, when I'm running echo $SHELL in hyper it returns /usr/local/bin/zsh instead of /bin/zsh

Hmm, seems strange, reading zshrc should not be influenced by what terminal you use. And the $SHELL thing seems similar to #4266
Will have to check and see if I can reproduce it.

I rebooted the laptop and echo $SHELL returns /bin/zsh as expected, the .zshrc however, is still not loaded. Also, I observed some weird behaviour:

sebastian@pazuzu ~ % source .zshrc
source: no such file or directory: .zshrc
sebastian@pazuzu ~ % pwd      
/Users/sebastian
sebastian@pazuzu ~ % source ~/.zshrc
source: operation not permitted: /Users/sebastian/.zshrc
sebastian@pazuzu ~ % cat ~/.zshrc
cat: /Users/sebastian/.zshrc: Operation not permitted
sebastian@pazuzu ~ % ls -la |grep zshrc
lrwxr-xr-x     1 sebastian  staff      41 Jun  6  2019 .zshrc -> /Users/sebastian/Documents/dotfiles/zshrc
-rw-r--r--     1 sebastian  staff     124 Feb 26 23:18 .zshrc.local
sebastian@pazuzu ~ % 

It seems that the .zshrc file is not accessible, but I can easily cat or source it (with the same /bin/zsh shell in any other terminal emulator.

Seems like a permission issue then?
Can you open Hyper from the default terminal using this
open /Applications/Hyper.app/Contents/MacOS/Hyper
and see if you can access .zshrc

I purged all of the hyper files, downloaded and installed it again, but still no luck. The $SHELL is correct, but it does not load the .zshrc.

After opening it this way: open /Applications/Hyper.app/Contents/MacOS/Hyper it loaded the .zshrc and I can access the file without a problem.

That means when opening the .app directly it's running with less privileges somehow. Which shouldn't be happening.
Nothing's coming to my mind right now on how to fix this, will have to research.
A quick hack solution can be to create .sh file which starts hyper and add that to the dock.

Likely not related to this, but I recently went through something similar, where there was an extra file (.zshrc.<something>), which was being read instead of .zshrc. It turned out to be some sort of "compiled" version of .zshrc.

@sbrych I note that you're on Catalina. It sounds like you may be hitting the new access controls. I'd recommend adding Hyper.app under System Preferences > Security & Privacy > Full Disk Access and try to reproduce again. You'll need to exit and restart Hyper after adding it to Full Disk Access.

@jwhitley Thank you very much for your tip, it works now. :)

Hi, this is still happening on macOS 10.15.5 (Catalina)

I tried giving full disk access to Hyper.app as suggested by @jwhitley but this did not change the output:

Screen Shot 2020-06-09 at 1 17 57 AM

.zshrc is clearly not being read. Also I installed anaconda using command line installer (which adds the conda() function to .zshrc) and this function is not available in Hyper, even when using zsh.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alejandrofloresm picture alejandrofloresm  路  3Comments

juicygoose picture juicygoose  路  3Comments

sarneeh picture sarneeh  路  3Comments

anthonyettinger picture anthonyettinger  路  3Comments

weabot picture weabot  路  3Comments