#安装nasm brew install nasm #创建文件 vi hello.asm 写入如下内容 msg: db "hello world!", 0x0a len: equ $-msg SECTION .text global _main kernel: syscall ret _main: mov rax,0x2000004 mov rdi,1 mov rsi,msg mov rdx,len call kernel mov rax,0x2000001 mov rdi,0 call kernel #编译 nasm -f macho64 -o hello.o hello.asm #链接 ld hello.o -o hello -macosx_version_min 10.13 -lSystem #运行 bogon:Desktop macname$ ./hello hello world! 参考: https://www.cnblogs.com/Cindy632/p/10767100.html