Spaceship-prompt: Installer clobbers symlinked .zshrc files

Created on 6 Jun 2017  路  6Comments  路  Source: denysdovhan/spaceship-prompt

Issue

My dotfiles are all in a git repo, and I symlink them to the proper locations. When I ran the spaceship installer, my .zshrc file was saved in the home directory as a file rather than a symlink.

Environment

Operating system: macOS
Terminal emulator: iTerm2
ZSH version: 5.0.8

bug

Most helpful comment

@asonix macOS sed doesn't appear to have a --follow-symlinks option. gnu-sed is available, but that doesn't seem like the proper solution.

Reference: https://sagebionetworks.jira.com/wiki/display/PLFM/Fixing+sed+on+OSx

All 6 comments

This is the fault of running sed on the symlink in the installer. I don't know about the macOS version, but the Linux version of sed has a --follow-symlinks flag that can be used to avoid this.

@asonix macOS sed doesn't appear to have a --follow-symlinks option. gnu-sed is available, but that doesn't seem like the proper solution.

Reference: https://sagebionetworks.jira.com/wiki/display/PLFM/Fixing+sed+on+OSx

Yeah, I've noticed I have the same problem. Let's find a solution together.

@denysdovhan How about using readlink ~/.zshrc to find the full path of the symlink target (also gives you the file path if it is not a symlink) and then running sed on the result of that?

edit: I originally said readlink -f ~/.zshrc, but that is not available for MacOS either :) The -f flag is to go to the last link if there is a series of links. Here is a SO answer for getting the -f functionality with a loop using vanilla readlink behavior.

https://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac

You can close this, the proposed 3.0 install script does not have this issue because. This is a working solution if you ever need sed in the future though.

Closed since #148 should fix these problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

salmanulfarzy picture salmanulfarzy  路  3Comments

doole picture doole  路  4Comments

oldchevy picture oldchevy  路  3Comments

jwhipp picture jwhipp  路  3Comments

maccius picture maccius  路  3Comments