pivotal / workstation-setup

Scripts to automatically set up a machine for development the "Tanzu Labs" way
https://github.com/pivotal/workstation-setup
MIT License
325 stars 240 forks source link

Get actual vim location for git editor #307

Closed textbook closed 2 years ago

textbook commented 2 years ago

Homebrew on M1 machines installs to /opt/homebrew, not /usr/local (see Homebrew/brew#9177). So I ended up seeing:

hint: Waiting for your editor to close the file... fatal: cannot run /usr/local/bin/vim: No such file or directory
error: unable to start editor '/usr/local/bin/vim'
Please supply the message using either -m or -F option.

This uses the brew --prefix to look in the right place in either architecture.

textbook commented 2 years ago

This also caused issues with dockutil, as /usr/local/bin doesn't exist: https://github.com/pivotal/workstation-setup/blob/9061781e864a0d5f0937cfa82fa896f84244c3b6/scripts/common/configuration-osx.sh#L26-L29 I wasn't sure whether brew --prefix was appropriate in that case, as we're not actually installing it with Homebrew. Maybe we should; there is a formula for it.

textbook commented 2 years ago

Looks like the other parts needing an update are:

joemoore commented 2 years ago

I like this PR and would like to merge it.

I did get the following error from dockutil since I have already run the main version of workstation-setup:

==> Pouring dockutil--2.0.5.all.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/dockutil
Target /usr/local/bin/dockutil
already exists. You may want to remove it:
  rm '/usr/local/bin/dockutil'

To force the link and overwrite all conflicting files:
  brew link --overwrite dockutil

To list all files that would be deleted:
  brew link --overwrite --dry-run dockutil

Possible conflicting files are:
/usr/local/bin/dockutil

To move on with life I did brew link --overwrite dockutil, reran, and had no errors.

I think this is okay. Better to move forward.