klaaspieter/chxcode

chxcode missing in /usr/local/share/

Closed this issue ยท 6 comments

Hello,

I installed chxcode using Homebrew successfully. No errors or warnings were thrown. I also added source /usr/local/share/chxcode/chxcode to my .zshrc file. But then I got the following error when I open the Terminal.

no such file or directory: /usr/local/share/chxcode/chxcode

I went and checked inside the /usr/local/share/ directory and indeed there was no chxcode folder inside it.

Am I missing some other step here? I'm on a 2020 M1 MacBook Pro running macOS 12.2.1. And my Homebrew version is 3.4.2.

Can you post the logs when you run:

brew install --verbose chxcode

Also what does brew --prefix print?

โžœ  ~ brew install --verbose chxcode
==> Downloading https://github.com/klaaspieter/chxcode/archive/0.0.3.tar.gz
Already downloaded: /Users/isuru/Library/Caches/Homebrew/downloads/e03f4131aec91401a31566c6fb7c5849d10009efc85030fd7c20d97350da6ff9--chxcode-0.0.3.tar.gz
==> Verifying checksum for 'e03f4131aec91401a31566c6fb7c5849d10009efc85030fd7c20d97350da6ff9--chxcode-0.0.3.tar.gz'
==> Installing chxcode from klaaspieter/formula
tar --extract --no-same-owner --file /Users/isuru/Library/Caches/Homebrew/downloads/e03f4131aec91401a31566c6fb7c5849d10009efc85030fd7c20d97350da6ff9--chxcode-0.0.3.tar.gz --directory /private/tmp/d20220325-86938-1wbrmf4
cp -pR /private/tmp/d20220325-86938-1wbrmf4/chxcode-0.0.3/. /private/tmp/chxcode-20220325-86938-sql4i4/chxcode-0.0.3
chmod -Rf +w /private/tmp/d20220325-86938-1wbrmf4
==> make install PREFIX=/opt/homebrew/Cellar/chxcode/0.0.3
objc[86960]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x205b4f678) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1080442c8). One of the two will be used. Which one is undefined.
objc[86960]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x205b4f6c8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x108044318). One of the two will be used. Which one is undefined.
for dir in `find share -type d 2>/dev/null`; do mkdir -p $dir /opt/homebrew/Cellar/chxcode/0.0.3/$dir; done
for file in `find share -type f 2>/dev/null`; do cp $file /opt/homebrew/Cellar/chxcode/0.0.3/$file; done
==> Cleaning
==> Finishing up
ln -s ../Cellar/chxcode/0.0.3/share/chxcode chxcode
==> Caveats
    Add the following to your ~/.bashrc or ~/.zshrc file:
      source /opt/homebrew/opt/chxcode/share/chxcode/chxcode

    To enable auto-switching of Xcode specified by .xcode-version files,
    add the following to your ~/.bashrc or ~/.zshrc:
      source /opt/homebrew/opt/chxcode/share/chxcode/auto
==> Summary
๐Ÿบ  /opt/homebrew/Cellar/chxcode/0.0.3: 6 files, 7.4KB, built in 1 second
==> Running `brew cleanup chxcode`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
/opt/homebrew

So your homebrew is located in /opt/homebrew which I believe is non-standard. Regardless the instructions mentioned in the installation caveats should work:

==> Caveats
    Add the following to your ~/.bashrc or ~/.zshrc file:
      source /opt/homebrew/opt/chxcode/share/chxcode/chxcode

    To enable auto-switching of Xcode specified by .xcode-version files,
    add the following to your ~/.bashrc or ~/.zshrc:
      source /opt/homebrew/opt/chxcode/share/chxcode/auto

It looks like this may be an M1 thing. I don't have an M1 machine so I'm struggling to follow along with the linked post, but hopefully it makes sense to you ๐Ÿ˜„

Edit: It is an M1 thing and it looks like /opt/homebrew is the default prefix on M1 Macs. I'm not yet sure how to best handle this in the README so I'll keep this issue open until I figure it out.

I ended up just adding seperate instructions for Apple Silicon Macs. Let me know if #12 fixes it for you.

Thanks for looking into this. The one mentioned in the output worked for me ๐Ÿ‘๐Ÿผ

source /opt/homebrew/opt/chxcode/share/chxcode/chxcode