Skip to content

Instantly share code, notes, and snippets.

@GUIEEN
Last active April 8, 2019 05:06
Show Gist options
  • Select an option

  • Save GUIEEN/c955d7394965a44fa69eae19c8a02745 to your computer and use it in GitHub Desktop.

Select an option

Save GUIEEN/c955d7394965a44fa69eae19c8a02745 to your computer and use it in GitHub Desktop.
How to compile objective c in mac
clang -framework Foundation <objc-file-name>.m 
./a.out

It would be better to use with this function :)

function run_objc {
   if [[ -n "$2" ]];then
       secArg=$2
       clang -framework Foundation $1 -o $2 && ./$secArg
   else
       secArg="a.out"
       clang -framework Foundation $1 && ./$secArg
   fi

   return 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment