Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get nasm to work as a command in terminal in MacOS?

I have been trying to get nasm to work as a command in terminal, but nothing seems to be working. I just keep getting the error:

nasm: error: unable to find utility "nasm", not a developer tool or in PATH

So, first, I tried updating my PATH variable. I tried editing the PATH variable:

safecrackers-MacBook-Pro-2:Library safecracker$ export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/Libraries/nasm-2.14/
safecrackers-MacBook-Pro-2:Library safecracker$ nasm
nasm: error: unable to find utility "nasm", not a developer tool or in PATH
safecrackers-MacBook-Pro-2:Library safecracker$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Library/Libraries/nasm-2.14/
safecrackers-MacBook-Pro-2:Library safecracker$ cd /Library/Libraries/nasm-2.14/
safecrackers-MacBook-Pro-2:nasm-2.14 safecracker$ ls
LICENSE     man1        ndisasm     rdf2ihx     rdfdump
README      nasm        rdf2bin     rdf2ith     rdflib
ldrdf       nasmdoc.pdf rdf2com     rdf2srec    rdx

I got the same error. Next, I tried installing nasm with homebrew:

safecrackers-MacBook-Pro-2:~ safecracker$ brew reinstall nasm
==> Reinstalling nasm 
==> Downloading https://homebrew.bintray.com/bottles/nasm-2.14.02.mojave.bottle.tar.gz
Already downloaded: /Users/safecracker/Library/Caches/Homebrew/downloads/8581149c56e4f6aa40f6c17f75921aeec141f01373082bda3c7c8afa5cf5fbd5--nasm-2.14.02.mojave.bottle.tar.gz
==> Pouring nasm-2.14.02.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/nasm/2.14.02: 30 files, 2.7MB
safecrackers-MacBook-Pro-2:~ safecracker$ nasm
nasm: error: unable to find utility "nasm", not a developer tool or in PATH

Again, I got the same error. I would love to finally figure this out.

like image 607
Dinosaur212 Avatar asked Dec 30 '18 00:12

Dinosaur212


People also ask

Does Nasm work on Mac?

Most tutorials for nasm are written with Linux in mind, so you'll usually need to make a few adjustments to get things working on macOS. NASM Hello World for x86 and x86_64 Intel Mac OS is a great place to start, and the NASM Tutorial a great place to go from there (see section 'Using NASM on macOS').

How do you use Terminal commands on a Mac?

In the Terminal app on your Mac, press the Up Arrow key. The last command you entered appears on the command line. Continue pressing the Up Arrow key until you see the command you want, then press Return.

What code does Terminal on Mac use?

The command line interface (CLI), or the language that you type into Terminal to interact with your Mac, is called bash.


2 Answers

To avoid /usr/bin/nasm be found first in PATH use

$ /usr/local/bin/nasm

to find the one installed by brew, or

alias nasm=/usr/local/bin/nasm

and then

$ nasm
like image 174
Diego Torres Milano Avatar answered Nov 14 '22 21:11

Diego Torres Milano


I have solved this problem by:

brew reinstall nasm
like image 34
Marvin Avatar answered Nov 14 '22 23:11

Marvin