Skip to content

Commit e0b9239

Browse files
author
tirolo
committed
Initial version
1 parent 6e50be1 commit e0b9239

File tree

6 files changed

+332
-1
lines changed

6 files changed

+332
-1
lines changed

.brew

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#### This file is for configuring brew and installing its specific formulaes
2+
3+
# Make sure we’re using the latest Homebrew
4+
brew update
5+
6+
# Upgrade any already-installed formulae
7+
brew upgrade
8+
9+
brew install git
10+
11+
# Used for https://github.com/lyze/posh-git-sh
12+
brew install bash-completion

.brewcask

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#### This file is for installing brew cask specific formulaes
2+
3+
brew cask install virtualbox
4+
5+
brew cask install vagrant

.custom_bash_profile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https://github.com/lyze/posh-git-sh#posh-git-bash
2+
source ~/git-prompt.sh
3+
export PROMPT_COMMAND='__posh_git_ps1 "\u@\h:\w" "\\\$ ";'$PROMPT_COMMAND
4+
5+
# https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion
6+
if [ -f $(brew --prefix)/etc/bash_completion ]; then
7+
. $(brew --prefix)/etc/bash_completion
8+
fi
9+
10+
# Case-insensitive globbing (used in pathname expansion)
11+
shopt -s nocaseglob;
12+
13+
# Autocorrect typos in path names when using `cd`
14+
shopt -s cdspell;

.macos

+245
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
#### This file is for applying MacOS configurations
2+
3+
# Close any open System Preferences panes, to prevent them from overriding
4+
# settings we’re about to change
5+
osascript -e 'tell application "System Preferences" to quit'
6+
7+
###############################################################################
8+
# General UI/UX #
9+
###############################################################################
10+
11+
# Disable smart quotes as they’re annoying when typing code
12+
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
13+
14+
# Disable smart dashes as they’re annoying when typing code
15+
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
16+
17+
# Save to disk (not to iCloud) by default
18+
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
19+
20+
# Disable Resume system-wide
21+
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
22+
23+
# Restart automatically if the computer freezes
24+
sudo systemsetup -setrestartfreeze on
25+
26+
###############################################################################
27+
# SSD-specific tweaks #
28+
###############################################################################
29+
30+
# Disable hibernation (speeds up entering sleep mode)
31+
sudo pmset -a hibernatemode 0
32+
33+
# Remove the sleep image file to save disk space
34+
sudo rm /private/var/vm/sleepimage
35+
# Create a zero-byte file instead…
36+
sudo touch /private/var/vm/sleepimage
37+
# …and make sure it can’t be rewritten
38+
sudo chflags uchg /private/var/vm/sleepimage
39+
40+
# Disable the sudden motion sensor as it’s not useful for SSDs
41+
sudo pmset -a sms 0
42+
43+
###############################################################################
44+
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
45+
###############################################################################
46+
47+
# Enable swap between full screen apps with 4 fingers swipe (so that I can use the 3 fingers bellow)
48+
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerHorizSwipeGesture -int 0
49+
# Enable select text with three fingers drag
50+
defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -int 1
51+
52+
# Use scroll gesture with the Ctrl (^) modifier key to zoom
53+
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
54+
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
55+
56+
# Follow the keyboard focus while zoomed in
57+
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
58+
59+
# Trackpad: enable tap to click for this user and for the login screen
60+
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
61+
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
62+
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
63+
64+
# Enable full keyboard access for all controls
65+
# (e.g. enable Tab in modal dialogs)
66+
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
67+
68+
# Disable auto-correct
69+
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
70+
71+
###############################################################################
72+
# Screen #
73+
###############################################################################
74+
75+
# Require password immediately after sleep or screen saver begins
76+
defaults write com.apple.screensaver askForPassword -int 1
77+
defaults write com.apple.screensaver askForPasswordDelay -int 0
78+
79+
# Save screenshots to the desktop
80+
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
81+
82+
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
83+
defaults write com.apple.screencapture type -string "png"
84+
85+
# Disable shadow in screenshots
86+
defaults write com.apple.screencapture disable-shadow -bool true
87+
88+
###############################################################################
89+
# Finder #
90+
###############################################################################
91+
92+
# Finder: disable window animations and Get Info animations
93+
defaults write com.apple.finder DisableAllAnimations -bool true
94+
95+
# Set Desktop as the default location for new Finder windows
96+
# For other paths, use `PfLo` and `file:///full/path/here/`
97+
defaults write com.apple.finder NewWindowTarget -string "PfDe"
98+
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
99+
100+
# Finder: show hidden files by default
101+
defaults write com.apple.finder AppleShowAllFiles -bool true
102+
103+
# Finder: show all filename extensions
104+
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
105+
106+
# Finder: show status bar
107+
defaults write com.apple.finder ShowStatusBar -bool true
108+
109+
# Finder: show path bar
110+
defaults write com.apple.finder ShowPathbar -bool true
111+
112+
# Display full POSIX path as Finder window title
113+
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
114+
115+
# Keep folders on top when sorting by name
116+
defaults write com.apple.finder _FXSortFoldersFirst -bool true
117+
118+
# When performing a search, search the current folder by default
119+
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
120+
121+
# Disable the warning when changing a file extension
122+
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
123+
124+
# Enable spring loading for directories
125+
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
126+
127+
# Remove the spring loading delay for directories
128+
defaults write NSGlobalDomain com.apple.springing.delay -float 0
129+
130+
# Avoid creating .DS_Store files on network or USB volumes
131+
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
132+
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
133+
134+
# Disable disk image verification
135+
defaults write com.apple.frameworks.diskimages skip-verify -bool true
136+
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
137+
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
138+
139+
# Use list view in all Finder windows by default
140+
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
141+
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
142+
143+
# Disable the warning before emptying the Trash
144+
defaults write com.apple.finder WarnOnEmptyTrash -bool false
145+
146+
# Show the ~/Library folder
147+
chflags nohidden ~/Library
148+
149+
###############################################################################
150+
# Dock, Dashboard, and hot corners #
151+
###############################################################################
152+
153+
# Enable highlight hover effect for the grid view of a stack (Dock)
154+
defaults write com.apple.dock mouse-over-hilite-stack -bool true
155+
156+
# Set the icon size of Dock items to 36 pixels
157+
defaults write com.apple.dock tilesize -int 36
158+
159+
# Change minimize/maximize window effect
160+
defaults write com.apple.dock mineffect -string "scale"
161+
162+
# Minimize windows into their application’s icon
163+
defaults write com.apple.dock minimize-to-application -bool true
164+
165+
# Wipe all (default) app icons from the Dock
166+
# This is only really useful when setting up a new Mac, or if you don’t use
167+
# the Dock to launch apps. I personally always launch apps from Spotlight Search.
168+
defaults write com.apple.dock persistent-apps -array
169+
170+
# Show only open applications in the Dock
171+
defaults write com.apple.dock static-only -bool true
172+
173+
# Don’t animate opening applications from the Dock
174+
defaults write com.apple.dock launchanim -bool false
175+
176+
# Speed up Mission Control animations
177+
defaults write com.apple.dock expose-animation-duration -float 0.1
178+
179+
# Don’t group windows by application in Mission Control
180+
# (i.e. use the old Exposé behavior instead)
181+
defaults write com.apple.dock expose-group-by-app -bool false
182+
183+
# Disable Dashboard
184+
defaults write com.apple.dashboard mcx-disabled -bool true
185+
186+
# Don’t show Dashboard as a Space
187+
defaults write com.apple.dock dashboard-in-overlay -bool true
188+
189+
# Don’t automatically rearrange Spaces based on most recent use
190+
defaults write com.apple.dock mru-spaces -bool false
191+
192+
# Remove the auto-hiding Dock delay
193+
defaults write com.apple.dock autohide-delay -float 0
194+
# Remove the animation when hiding/showing the Dock
195+
defaults write com.apple.dock autohide-time-modifier -float 0
196+
197+
# Automatically hide and show the Dock
198+
defaults write com.apple.dock autohide -bool true
199+
200+
# Make Dock icons of hidden applications translucent
201+
defaults write com.apple.dock showhidden -bool true
202+
203+
###############################################################################
204+
# Terminal #
205+
###############################################################################
206+
207+
# Enable Secure Keyboard Entry in Terminal.app
208+
# See: https://security.stackexchange.com/a/47786/8918
209+
defaults write com.apple.terminal SecureKeyboardEntry -bool true
210+
211+
###############################################################################
212+
# Time Machine #
213+
###############################################################################
214+
215+
# Prevent Time Machine from prompting to use new hard drives as backup volume
216+
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
217+
218+
# Disable local Time Machine backups
219+
hash tmutil &> /dev/null && sudo tmutil disablelocal
220+
221+
###############################################################################
222+
# Activity Monitor #
223+
###############################################################################
224+
225+
# Show the main window when launching Activity Monitor
226+
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
227+
228+
# Visualize CPU usage in the Activity Monitor Dock icon
229+
defaults write com.apple.ActivityMonitor IconType -int 5
230+
231+
# Show all processes in Activity Monitor
232+
defaults write com.apple.ActivityMonitor ShowCategory -int 0
233+
234+
# Sort Activity Monitor results by CPU usage
235+
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
236+
defaults write com.apple.ActivityMonitor SortDirection -int 0
237+
238+
###############################################################################
239+
# Photos #
240+
###############################################################################
241+
242+
# Prevent Photos from opening automatically when devices are plugged in
243+
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
244+
245+
echo "Done. Note that some of these changes require a logout/restart to take effect."

README.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
# dotfiles
1+
# dotfiles
2+
How I get my own mac configured, hassle free.
3+
4+
How I got this done? By reading the most awesome dotfiles post ever:
5+
[Setting Up a Mac Dev Machine From Zero to Hero With Dotfiles](https://code.tutsplus.com/tutorials/setting-up-a-mac-dev-machine-from-zero-to-hero-with-dotfiles--net-35449)
6+
7+
Want to create a new config for your `.macos` and have no idea what the key is? [Check this out](https://github.com/mathiasbynens/dotfiles/issues/5#issuecomment-4117712)
8+
9+
# Many thanks to
10+
the following guys whose I copied 99.9% of this repo content/ideas:
11+
- <https://github.com/mathiasbynens/dotfiles>
12+
- <https://github.com/paulirish/dotfiles>
13+
- <https://github.com/geerlingguy/dotfiles>
14+
- <http://dotfiles.github.io/>
15+
16+
I also make use of: [posh-git-sh](https://github.com/lyze/posh-git-sh)
17+
18+
# Instructions
19+
First of all I will borrow the warning from [mathiasbynens dotfiles repo](https://github.com/mathiasbynens/dotfiles)
20+
21+
**Warning:** If you want to give these dotfiles a try, you should first fork this repository, review the code, and remove things you don’t want or need. Don’t blindly use my settings unless you know what that entails. Use at your own risk!
22+
23+
## One-liner execution
24+
**NOTE** It will execute ALL the configurations on your computer so make sure you understand it before executing the following code :)
25+
26+
```$(curl -fsSL https://raw.githubusercontent.com/tirolo/dotfiles/master/bootstrap.sh)```

bootstrap.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Ask for the administrator password upfront
2+
sudo -v
3+
4+
# Check for Homebrew and install if we don't have it
5+
if test ! $(which brew); then
6+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
7+
fi
8+
9+
# Run dotfiles
10+
$(curl -fsSL https://raw.githubusercontent.com/tirolo/dotfiles/master/.macos)
11+
$(curl -fsSL https://raw.githubusercontent.com/tirolo/dotfiles/master/.brew)
12+
$(curl -fsSL https://raw.githubusercontent.com/tirolo/dotfiles/master/.brewcask)
13+
14+
# Copy .custom_bash_profile to home
15+
curl -fsSL https://raw.githubusercontent.com/tirolo/dotfiles/master/.custom_bash_profile > ~/.custom_bash_profile
16+
17+
# Add it to the .bash_profile
18+
bashProfileFilePath=~/.bash_profile
19+
20+
# Check if file exists
21+
if [ -f $bashProfileFilePath ]; then
22+
# Check for the content is already in the file
23+
if ! grep -q "source[[:space:]].custom_bash_profile" $bashProfileFilePath; then # Is there nay better way to match the whitespace?
24+
# If not, add it
25+
echo "" >> $bashProfileFilePath # Add new line first
26+
echo "source .custom_bash_profile" >> $bashProfileFilePath
27+
fi
28+
else
29+
echo ".bash_profile not found"
30+
fi

0 commit comments

Comments
 (0)