#安裝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