The System Preferences appear to be stored in various places, depending on whether they are user or system specific. A lot of them are stored in either /Library/Preferences/
or $HOME/Library/Preferences/
(for per-user settings). But each preference pane will have its own way of storing them.
You can see which preferences are stored this way by typing:
defaults read <domain>
Where <domain>
is either the start of the filename in your per-user system preferences, or the full path to a .plist
file. For example:
defaults read com.apple.screensaver
defaults read /Library/Preferences/com.apple.screensaver
The former will show your per-user customisation of the screensaver settings, while the latter will show the system screensaver settings.
The settings are largely organised by preference pane, though not necessarily that straight forward. You'll likely have to poke around in /Library/Preferences
and sub-folders (especially SystemConfiguration
) to find them all.
One option would be to just copy the relevant files out, and put them back in place for new installations.
Another way would be to export and import it as required.
Exporting the Power Management (Energy Saver) System Preferences to pm.plist:
defaults export /Library/Preferences/SystemConfiguration/com.apple.PowerManagement pm.plist
Importing those preferences from pm.plist
on the new computer:
defaults import /Library/Preferences/SystemConfiguration/com.apple.PowerManagement sysprefs.plist
You may even want to edit the various exported .plist
files if there are specific system preferences you do/don't want to share between computers. That way you can have some customisation locally, and the import
command will not overwrite those, just add the ones you've set in the .plist
files. You can use the defaults
command to modify your own .plist
files as well (but make sure you specify the full path to the file, not just a name, or you may be modifying your per-user preferences).
Bash only reads scripts by default in your home directory, or if they are missing in /etc
. See Bash's documentation. If using OSX's Terminal.app then by default it reads ~/.bash_profile
.
This is true of all bash on Linux or other OSes.
To read from another directory e.g. /opt/local/etc/bash_completion.d
you have to edit your start up files to source (i.e. include) the files from there
The instructions for the script do not mention /opt/local/...
which is a non standard location on any Unix. (by non-standard it is allowed to be used by third party packages but not defined what should be in there) They say
- Copy this file to somewhere (e.g.
~/.git-completion.sh
).
Add the following line to your .bashrc
/.zshrc
:
source ~/.git-completion.sh
- Consider changing your PS1 to also show the current branch,
see
git-prompt.sh
for details.
The progit quote assumes you know bash. All it is saying is put the files from the first quote into a specific place if you want all users on the machine to use them and not in ~
where only the user installing it can see them. i.e. the point is multi user versus single user.
He also picks that path as nothing else uses it and you should not edit /etc
files in OS X as Apple's OS upgrades could overwrite them so you need to choose another place. (I would have chosen something under /usr/local
as there is where manually maintained scripts are meant to go).
~/.bashrc
is the correct place to edit and add the source. See your other question and the bash manual for setting up ~/.bash_profile
The bash suggested way is source .bashrc
into .bash_profile
. Note that on OS X using Terminal.app is not the one way of running shells so there can be sessions starting with .bashrc
.
Best Answer
That looks like a shell script that is missing the shebang at the top of the file.
It could be that it is intended to be copied into an existing script to provide OS X-specific functionality so the main script can be portable (I'd expect there to be dotfiles for other operating systems, as well.)
On the other hand, it could be intended as a file of ideas and you pick the ones you want and paste them into your
.bashrc
or.bash_profile
.