Another option is Docker, https://store.docker.com/editions/community/docker-ce-desktop-mac.
Might need to learn a little about containers, but well worth it as many companies run containers, and it is a good skill to have. After downloading, installing and starting Docker (runs as a daemon), you can use the 20 MB alpine linux + binutils image to run as, ld and your very own executables. Brief synopsis: These 2 steps just need to be done once. 1. Create exec.Dockerfile with the following content FROM alpine:3.7 RUN apk add --update binutils CMD ["$@"] 2. Build the image (if you make changes to the Dockerfile, you can always re-run this) $ docker build -t exec -f exec.Dockerfile . Repeat the following for each program you write. 1. Create your assembler program (exit.s) .section .data .section .text .globl _start _start: movl $1, %eax movl $1, %ebx int $0x80 2. Assemble docker run --rm -v `pwd`:/tmp/local -t exec as /tmp/local/exit.s -o /tmp/local/exit.o 3. Link docker run --rm -v `pwd`:/tmp/local -t exec ld /tmp/local/exit.o -o /tmp/local/exit 4. Execute docker run --rm -v `pwd`:/tmp/local -t exec /tmp/local/exit *The -v `pwd`:/tmp/local option creates a volume (maps your local directory to a directory within the container) that the container can read from/write to. On Wed, Nov 28, 2018 at 8:48 PM John de la Garza <[email protected]> wrote: > On Wed, Nov 28, 2018 at 02:50:40AM +0000, Davis Pham wrote: > > Hi there, > > > > I’m new to learning programming and I’m currently trying to teach myself > using the textbook “Programming from the Ground Up” by Jonathan Bartlett. > However I only have access using a MacBook Pro and the textbook teaches > theory based on linux. Is it possible for me to install a linux program on > Mac so that I would be able to follow the lessons provided? Without having > to completely install a new operating system on my Mac? > > great book...use 'brew' to install QEMU which will boot Linux > > find and boot a Linux image that has dev stuff (which is typical) and > start using gas (gnu assembler) and the other Binutils stuff > > you can even install Binutils on your mac, but if you want to do the book > with no changes (like system call numbers) you'll need to boot Linux > > _______________________________________________ > Pgubook-readers mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/pgubook-readers >
_______________________________________________ Pgubook-readers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/pgubook-readers
