Search code examples
gnu-makesymlink

Symlink make as gmake on Mac


I am running a program (OpenModelica OMEdit 1.18.0~dev-109-ged8ef0a) which requires gmake for one of its operations. gmake is not installed on my Mac (Big Sur 11.5.2) but make is. I tried to symlink gmake to point at make but it does not work:

➜  where make         
/usr/bin/make
➜  make -v | HEAD -n 1
GNU Make 3.81
➜  pwd
/opt/openmodelica/bin
➜  sudo ln -s /usr/bin/make /opt/openmodelica/bin/gmake
➜  ls -lh gmake
lrwxr-xr-x  1 root  wheel    13B 13 Dec 09:15 gmake -> /usr/bin/make
➜  /opt/openmodelica/bin/gmake -v
gmake: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -find gmake 2> /dev/null' failed with exit code 17664: (null) (errno=Invalid argument)
xcode-select: Failed to locate 'gmake', requesting installation of command line developer tools.

It prompts each time to install the XCode command line developer tools which I have already done. From the error message it looks like it is trying to find gmake despite pointing at the make executable? (Why is it erroring?) Is there a way to get this to work as I was expecting or do I have to install gmake using brew then symlink to that?

Command line tools version:

➜ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 12.5.1.0.1.1623191612
volume: /
location: /
install-time: 1639360537
groups: com.apple.FindSystemFiles.pkg-group

** edit **

I'm using zsh 5.8 (x86_64-apple-darwin20.0), I don't know if that's a factor in the gmake symlink to make not working correctly?


Solution

  • I don't understand why this works but from @Holger Just's comment:

    ➜ brew install make
    

    This will add a symlink:

    ➜ ls -lh /usr/local/bin/gmake
    /usr/local/bin/gmake@ -> ../Cellar/make/4.3/bin/gmake
    

    And then symlinking to that instead:

    ➜ sudo ln -s /usr/local/bin/gmake /opt/openmodelica/bin/gmake
    

    ... works as expected:

    ➜ /opt/openmodelica/bin/gmake -v | head -n 1
    GNU Make 4.3