A little bit of background. I'm running macOS 10.14.6 currently. I have had Nim installed in the past as well, but I don't recall the version number. I did manually remove Him at one point, deleting .choosenim and .nimble from my Mac home directory. Now, I'm trying to reinstall Nim using; curl https://nim-lang.org/choosenim/init.sh -sSf | sh, but I keep getting errors when I do:
curl https://nim-lang.org/choosenim/init.sh -sSf | sh
choosenim-init: Downloading choosenim-0.4.0_macosx_amd64
Downloading Nim 1.0.2 from nim-lang.org
Info: /Users/username/.choosenim/downloads/nim-1.0.2.tar.gz already downloaded
Extracting nim-1.0.2.tar.gz
Building Nim 1.0.2
Exception: Execution failed with exit code 1
... Command: sh build.sh
... Output: # OS: macosx
... # CPU: amd64
... clang -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/stdlib_assertions.nim.c -o c_code/1_2/stdlib_assertions.nim.o
... clang -w -O3 -fno-strict-aliasing -Ic_code -c c_code/1_2/stdlib_dollars.nim.c -o c_code/1_2/stdlib_dollars.nim.o
... c_code/1_2/stdlib_dollars.nim.c:7:10: fatal error: 'string.h' file not found
... #include <string.h>
... ^~~~~~~~~~
... 1 error generated.
Cleaning failed build
Tip: 7 messages have been suppressed, use --verbose to show them.
Error: Build failed
I'm not sure why the Nim error is reporting a missing .h file. I've been trying to solve this for multiple days now with no luck. Any help would be greatly appreciated. Thank you.
Hi joe_04_04,
How about checking this thread? https://stackoverflow.com/questions/52509602/cant-compile-c-program-on-a-mac-after-upgrade-to-mojave
Thanks you very much for the link, however, the solution proposed is to use the command that installs the headers, but attempting to install that throws the follow scary error:
"Installing this package may damage your system, and the installation may fail. To stop the program and the installation, click “Cancel Installation."
I'm not sure how to proceed at this moment.
Did you install Xcode? If not, please install it first from https://apps.apple.com/jp/app/xcode/id497799835 And then, install 'Command Line Tools' by running the below command in the terminal.
xcode-select --install
Yeah, I have Xcode installed and I have ran the command you suggested, but macOS shows a message indicating I already have the CLTs installed:
"Command line tools are already installed, use "Software Update" to install updates."
Well, I'm not sure what fixed it, but I was able to finally install Nim. I updated a large amount of items on my computer and then was able to reinstall Zim. Here is the subset of items that I updated that might of fixed my problem:
Brew Upgrade Brew upgrade llvm Brew upgrade cmake
Updated Xcode