About Mac computer's file permission
sudo is needed to change permissions of files and folders that the current user account does not have permissions to modify.

In this case, the chmod myname required sudo because some of the files and folders being modified were owned by root.

By default, the first user account is an administrator. This is likely the account you are currently using. Administrator permissions are not equivalent to those of root. root exists above administrator users on OS X.

With regard to how best to deploy Joomla on a production server, this is better asked in a separate question.