You can create a shell script or a Python or Ruby script and run it on the Mac by using \"Terminal\" ... if you have Finder open, and you click on the icon for the file cont
Yes - just put a .command suffix on the script.
.command
Note: make sure the script is executable, e.g.
$ chmod +x myscript.command