如何在Mac OS的终端中让nasm作为命令工作?

时间:2018-12-30 00:10:39

标签: bash macos terminal nasm

我一直试图使nasm在终端中作为命令运行,但是似乎没有任何效果。我只是不断得到错误:

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

因此,首先,我尝试更新PATH变量。我尝试编辑PATH变量:

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

我遇到了同样的错误。接下来,我尝试使用自制软件安装nasm:

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

再次,我遇到了同样的错误。我很想终于明白这一点。

3 个答案:

答案 0 :(得分:2)

要避免在路径中首先找到/usr/bin/nasm,请使用

$ /usr/local/bin/nasm

查找由brew安装的一个,或者

alias nasm=/usr/local/bin/nasm

然后

$ nasm

答案 1 :(得分:1)

我通过以下方式解决了这个问题:

brew reinstall nasm

答案 2 :(得分:0)

我解决了这个问题

sudo chown -R "your_username_folder" /usr/local/share/man/man8 

在终端上

在执行此命令和

之后,我的冲煮器配置不正确
brew install nasm

我的NASM命令正常工作

在MacOS Mojave Beta 4上完成