Running an executable in Mac Terminal

后端 未结 2 1714
孤街浪徒
孤街浪徒 2020-12-13 08:35

I just made a .c file and compiled it with gcc in the terminal on OS X 10.8.2.

My syntax was gcc -o and that was fi

2条回答
  •  生来不讨喜
    2020-12-13 09:13

    To run an executable in mac

    1). Move to the path of the file:

    cd/PATH_OF_THE_FILE
    

    2). Run the following command to set the file's executable bit using the chmod command:

    chmod +x ./NAME_OF_THE_FILE
    

    3). Run the following command to execute the file:

    ./NAME_OF_THE_FILE
    

    Once you have run these commands, going ahead you just have to run command 3, while in the files path.

提交回复
热议问题