# Install Nim

Assuming that xcode is installed on your machine already. `choosenim` doesn't 
currently support M1 Mac. So you will need to build it.
    
    
    git clone https://github.com/nim-lang/nim.git nim
    git clone -q --depth 1 https://github.com/nim-lang/csources_v1.git csources
    cd csources
    sh build.sh
    cp bin/nim ../nim/bin/nim
    cd ../nim
    bin/nim c --skipUserCfg --skipParentCfg koch
    ./koch boot -d:release --skipUserCfg --skipParentCfg
    
    # To install all tools (for IDE etc)*
    ./koch tools
    
    Run

Put the nim directory somewhere safe (e.g. `$HOME/bin`) and add it in the 
`PATH` (in your .zshrc or .bashrc)

e.g. `export PATH=$PATH:$HOME/bin/Nim/bin:$HOME/bin/Nim:$HOME/.nimble/bin`

# Install Visual Code

Install Visual studio code for Mac, the Apple Silicon Version

Install the following plugins:

  1. [Nim Nimsaem 
plugin](https://marketplace.visualstudio.com/items?itemName=nimsaem.nimvscode)
  2. [Code LLDB Vadimcn 
plugin](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)



To make builds and debugging run get the vscode file from 
[https://github.com/ranedk/nimhello](https://forum.nim-lang.org/postActivity.xml#httpscolonslashslashgithubdotcomslashranedkslashnimhello)

# Pain points

 **LLDB is not in python path**

Check by starting python3 console and `import lldb`. If it doesn't work, update 
`PYTHONPATH` (in your zshrc or bashrc) with:

`export 
PYTHONPATH="/opt/homebrew/Cellar/llvm/12.0.0_1/libexec/python3.9/site-packages:$PYTHONPATH"`

If you know the right (or better) place to pick up python lldb package, put 
that in your PYTHONPATH

Start `lldb` shell from the base folder, on lldb prompt, type: `command script 
import ./.vscode/lldbnim.py` If it works, lldb with Nim is good to go.

Try putting a break point and "Run and Debug" > "Nimble debugger".

Reply via email to