Skip to content

Commit

Permalink
Adds various macOS settings & Gaming App «Heroic»
Browse files Browse the repository at this point in the history
macOS settings: Apple Messages & Music apps, fn-Key functionality, draggable windows, Trash bin auto-cleanup, Mouse acceleration.
  • Loading branch information
Swiss-Mac-User committed May 5, 2024
1 parent 2759a68 commit 5702cfa
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 47 deletions.
27 changes: 27 additions & 0 deletions Applications/Heroic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env zsh

# Transmission.app
function installAppHeroicGamesLauncher(){
# --> App version to use
local version="2.14.1"
local platform="-arm64"
# --> Set Download URL
if checkIfAppleSilicion; then
# ...for ARM-based Apple Silicon Macs
local downloadUrl="https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/download/v$version/Heroic-$version-macOS-arm64.dmg"
else
# ...for Intel-based Macs
platform=""
local downloadUrl="https://github.com/Heroic-Games-Launcher/HeroicGamesLauncher/releases/download/v$version/Heroic-$version-macOS-x64.dmg"
fi
# --> Download
downloadFromUrl "downloadUrl" "Heroic.dmg"
# --> Mount & copy
# (Cannot use unmountFile() function due to Volume having a different name than the App)
hdiutil attach "$downloadFolder/Heroic.dmg" -quiet
cp -r "/Volumes/Heroic $version$platform/Heroic.app" "$downloadFolder"
# --> Unmount & move
hdiutil unmount "/Volumes/Heroic $version-$platform" -force -quiet
moveApplication "Heroic.app"
}
export -f installAppHeroicGamesLauncher
76 changes: 47 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,88 @@
Automate your macOS setup
===

**Welcome to the macOS Scripted Setup!<br>This project helps Mac users quickly and easily set up a new computer or useraccount by automatically configuring a range of system settings and installing commonly used applications.**
**Welcome to the macOS Scripted Setup.<br>This project helps Mac users quickly and easily set up a new computer or useraccount by automatically configuring a range of system settings and installing commonly used applications.**

> [!TIP]
> The scripted setup was tested on Intel-based Macs & Apple Silicon Macs
> On macOS 12 Monterey up to macOS 14 Sonoma

## What is this?

The macOS Scripted Setup is **perfect for users who want to save time and avoid the hassle of manually changing settings and installing apps**. The whole project, but particularly the configuration file, is **portable** - so you can keep them on a USB-stick for the next Mac setup. Give it a try and streamline your new Mac setup process!

![Screenshot of macOS Scripted Setup in action](/README_demo.png?raw=true)

The script is easy to use and can be run directly from the Terminal application, as a regular user or admin user. It automatically performs a series of commands to change default macOS settings and download applications. It's designed to be widely backward and forward compatible with various macOS versions.

**All settings can be configured!** Some features include enabling the firewall, setting better security features, customising the Finder, Dock, and Mission Control for better productivity; and many more. Additionally, the script installs applications such as browsers, media players, productivity apps, and web development tools.
**All settings can be configured.** Some features include enabling the firewall, setting better security features, customising the Finder, Dock, and Mission Control for better productivity; and many more. Additionally, the script installs applications such as browsers, media players, productivity apps, and web development tools.

The macOS Scripted Setup is **perfect for users who want to save time and avoid the hassle of manually changing settings and installing apps**. The whole project, but particularly the configuration file, is **portable** - so you can keep them on a USB-stick for the next Mac setup. Give it a try and streamline your new Mac setup process!
### What is being done exactly?

## How to use
<details>
<summary>See what features, settings, and applications can be changed / installed</summary>

### The script can change the following settings:

* FileVault, macOS Firewall, Mission Control, Control Centre, Finder, Dock, git, SSH Key, adds Userhome folders, Menu bar clock, Fast User Switching, and [more](https://github.com/Swiss-Mac-User/macOS-scripted-setup/tree/installer/Usersettings).

<sub>P.s.: the scripts were tested successfully on Apple Silicon Mac and macOS 13 Ventura.</sub>
### …and is capable of installing these Apps:

Some Apps are downloaded from the official websites, other are added through Homebrew or its Mac App Store CLI extension.

* 1Password, AlDente, Beyond Compare, Boop, Brave, Composer, Discord, Docker, eqMac, Fig, Firefox, Fork, GasMask, Git, Google Chrome, Homebrew, Keka, LinearMouse, MAMP, Nova, Pixelmator Pro, Quick Look plugins, Rosetta 2, Safari extensions, Sequel Ace, SonarQube, Spotify, Steam, Strongbox, Telegram, Transmission, Tresorit, Warp, Xcode Command Line Tools, Xnapper, and [more](https://github.com/Swiss-Mac-User/macOS-scripted-setup/tree/installer/Applications).
</details>


## How to use

### 📥 Download macOS Scripted Setup

Fast and easy download with this command in the `Terminal.app`:
Automatic download with this command in the `Terminal.app` from Applications » Utilities:

```bash
curl -SL "https://github.com/Swiss-Mac-User/macOS-scripted-setup/archive/refs/heads/installer.zip" | tar xz -C "$HOME/Downloads" && open "$HOME/Downloads/macOS-scripted-setup-installer"
```

Alternatively you can manually download & extract the latest «Source code (zip)» [from Releases](/../../releases) to your `~/Downloads/` folder.
Alternatively you can manually download & extract the latest «Source code (zip)» [from Releases](/../../releases) to your `~/Downloads/` folder.

### ⚙️ Configure your preferences

1. Duplicate the file `config.default.sh` as `config.sh`

2. Open `config.sh` with TextEdit
2. Open `config.sh` in a Text editor (e.g. `TextEdit.app`)

3. …and change all settings to your personal preferences, using `true`/`false`.

> [!WARNING]
> If no `config.sh`-file is present, the setup will use the default configs from `config.default.sh`!</sup>
#### Advanced settings
<details>
<summary>Configuring custom bash commands to run</summary>

If you want to run additional bash commands as part of the setup, you can duplicate the template-file `mycommands.template.sh` as `mycommands.sh`, and populate it with any commands. These custom commands will be executed LAST in the whole setup (see the `run.sh` file).

</details>

3. …and change all settings to your personal preferences, using `true`/`false`.<br>(Note: if no `config.sh` is present, it will fall back to the default configs)

### 🚀 Start the scripted Setup

Maybe now is the time to go and get a coffee ☕️…
Maybe now is the time to [grab a coffee ☕️](https://bmc.link/swissmacuser/)

1. Open the «Terminal.app» from Applications » Utilities

2. Paste the following command to the Terminal.app, and start the setup by pressing `Return`:
2. Paste the following command to the Terminal.app:

```bash
cd ~/Downloads/macOS-scripted-setup-installer/ && chmod +x ./run.sh && ./run.sh
```

Watch the magic happen… and occasionally interact when instructions show up (e.g. sign-in on the Mac App Store-App).
3. Now start the setup by pressing `Return` & watch the magic happen…

> [!TIP]
> **Occasionally you have to interact** when instructions show up, such as to sign-in on the Mac App Store.
#### ✨ That's it - happy installation! :)

Expand All @@ -61,23 +96,6 @@ Report an [Issue](/../../issues) or start a [new Discussion](/../../discussions)
Feel free to [fork this project](/../../fork) and add Pull Requests for any suggested changes or additions!



## Advanced settings

If you want to run additional bash commands as part of the setup, you can duplicate the template-file `mycommands.template.sh` as `mycommands.sh`, and populate it with any commands. These custom commands will be executed LAST in the whole setup (see the `run.sh` file).

### What is being done?

The script changes the following settings:

* FileVault, macOS Firewall, Mission Control, Control Centre, Finder, Dock, git, SSH Key, adds Userhome folders, Menu bar clock, Fast User Switching, and more.

…and is capable of installing these Apps:

* Xcode Command Line Tools, Homebrew, Rosetta 2, Keka, Quick Look plugins, 1Password, Safari extensions, Beyond Compare, Discord, Fig, Firefox, Google Chrome, Pixelmator Pro, Spotify, Strongbox, Telegram, Transmission, Tresorit, Warp, Xnapper, Git, Boop, Composer, Docker, SonarQube, Fork, GasMask, MAMP, Nova, Sequel Ace, and others.

Some Apps are downloaded from the official websites, other are added through Homebrew or its Mac App Store CLI extension.

---

<p align="center"><a href="https://bmc.link/swissmacuser/">
Expand Down
12 changes: 12 additions & 0 deletions Usersettings/Finder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ function disableNaturalScrolling(){
}
export -f disableNaturalScrolling

# Interface: allow dragging windows anywhere using Command+Control+Click
function enableFullWindowDragzone(){
defaults write NSGlobalDomain "NSWindowShouldDragOnGesture" -bool TRUE
}
export -f enableFullWindowDragzone

# Interface, disable menu bar transparency
function disableTransparencyAndTinting(){
defaults write NSGlobalDomain "AppleEnableMenuBarTransparency" -bool FALSE
Expand Down Expand Up @@ -148,6 +154,12 @@ function disableEmptyTrashWarning(){
}
export -f disableEmptyTrashWarning

# Automatically remove items from the Trash after 30 days
function enableTrashAutoremove30days(){
defaults write com.apple.finder "FXRemoveOldTrashItems" -bool TRUE
}
export -f enableTrashAutoremove30days

# Add Folder settings (.DS_Store files)
function updateApplicationsFolderListColumns(){
if ! checkIfFileExists "$HOME/Applications/.DS_Store"; then
Expand Down
23 changes: 23 additions & 0 deletions Usersettings/Keyboard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env zsh

# Keyboard fn 🌐 key shows Emoji & Symbols popup. Supported values:
# --> 0 = No function / do nothing (default)
# --> 1 = Change keyboard input source
# --> 2 = Show "Emoji & Symbols"
# --> 3 = Start Dictation (press 2x)
function useFnKeyFor(){
local changeMode=false
local configFnKeyFunctionanlity=$1
case "$configFnKeyFunctionanlity" in
off) changeMode=0;;
language) changeMode=1;;
emoji) changeMode=2;;
dictation) changeMode=3;;
*) changeMode=false;;
esac

if [ "$changeMode" != false ]; then
defaults write com.apple.HIToolbox "AppleFnUsageType" -int $changeMode
fi
}
export -f useFnKeyFor
8 changes: 8 additions & 0 deletions Usersettings/Messages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env zsh

# Show the subject field in Messages (subjects are sent in bold format)
# Source: https://gist.github.com/getaaron/a9dc64b6ea2fa8299af6b7077f4386ae
function enableMessagesSubjectField(){
defaults write com.apple.MobileSMS "MMSShowSubject" -bool TRUE
}
export -f enableMessagesSubjectField
7 changes: 7 additions & 0 deletions Usersettings/Music.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env zsh

# Display «Playing next» Notification
function showNextSongNotification(){
defaults write com.apple.Music "userWantsPlaybackNotifications" -bool TRUE
}
export -f showNextSongNotification
7 changes: 4 additions & 3 deletions Usersettings/Screenshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ export -f useNumericScreenshots
# Supported file types: png (default), bmp, gif, heic, jpg, jp2, tif, pict, pdf, tga, tiff
function saveScreenshotsAs(){
local changeFormat=false
case "$ScreenshotsImageFormat" in
local configUseScreenshotsFormat="$1"
case "$configUseScreenshotsFormat" in
png) changeFormat=false;;
bmp|gif|heic|jpg|jp2|tif|pict|pdf|tga|tiff) changeFormat="$ScreenshotsImageFormat";;
bmp|gif|heic|jpg|jp2|tif|pict|pdf|tga|tiff) changeFormat="$configUseScreenshotsFormat";;
*) changeFormat=false;;
esac

# Screenshot format is valid and not default (png):
if [ ! "$changeFormat" ]; then
if [ "$changeFormat" != false ]; then
defaults write com.apple.screencapture "type" -string "$changeFormat"
fi
}
Expand Down
13 changes: 10 additions & 3 deletions Usersettings/Trackpad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ function enableTrackpadClicking(){
# Enable Single Tap to Click
defaults write com.apple.AppleMultitouchTrackpad "Clicking" -int 1
# Enable Right Click
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode -string 'TwoButton'
defaults write com.apple.AppleMultitouchTrackpad "TrackpadRightClick" -int 1
}
export -f enableTrackpadClicking

# --> Increase Mouse speed on Trackpads and Mouses
function increaseMouseSpeed(){
# -g = Setting is in .GlobalPreferences.plist
defaults write -g com.apple.trackpad.scaling -int 2
defaults write -g com.apple.mouse.scaling -float 1.5
defaults write NSGlobalDomain com.apple.trackpad.scaling -int 2
defaults write NSGlobalDomain com.apple.mouse.scaling -float 1.5
}
export -f increaseMouseSpeed

# --> Disable Mouse cursor acceleration
function disableMouseAcceleration(){
defaults write NSGlobalDomain com.apple.mouse.linear -bool YES

}
export -f disableMouseAcceleration
33 changes: 22 additions & 11 deletions config.default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ removeiMovie=false
# -- 2.2 Required Applications --
# (others have dependencies for these)
installXcodeTools=false
installHomebrew=false
installHomebrew=true
installAppStoreApps=true # <-- requires Homebrew=TRUE
installRosetta=false

Expand All @@ -81,15 +81,15 @@ installSyntaxHighlightQuickLook=true
# -- 2.4 Install Applications --
install1Password=false
installAdGuardSafari=true
installAlDente=true # <-- only supported on MacBooks (MBA, MBP)
installAlDente=false # <-- only supported on MacBooks (MBA, MBP)
installBeyondCompare=false
installBraveBrowser=false
installDiscord=false
installEqMac=false
installFigma=false
installFirefox=false
installGoogleChrome=false
installGrandPerspective=true
installGrandPerspective=false
installLinearMouse=false
installMacsFanControl=false
installMicrosoftOffice=false
Expand All @@ -115,31 +115,41 @@ installBoop=false
installComposer=false # <-- will also install PHP
installDocker=false # <-- only installed when MAMP=FALSE
useOrbStackOverDocker=false # <-- use OrbStack instead of Docker
installSonarQube=false # <-- only installed when Docker=TRUE
installFork=false
installGasMask=false
installMAMP=false
installSequelAce=false
installSonarQube=false # <-- only installed when Docker=TRUE

# -- 2.6 Mac Gaming Apps and Games --
installHeroicGamesLauncher=false
installSteam=false
installWhisky=false

# ------------------------------
# 3. User and App Settings
# ------------------------------
# -- 3.1 macOS Layout / User Interface --
# ---- 3.1.1 Menu Bar ----
dateTimeInMenubar=true
useMissionControl=true
enableFastUserswitching=true
useMissionControl=true
disableTransparency=true
showBatteryPercentage=true # <-- only applied on MacBooks (MBA, MBP)
# ---- 3.1.2 Window handling ----
enableFullDraggableWindows=false
showScrollbars=true
disableNaturalScrolling=true
# ---- 3.1.3 Text handling ----
disableAnnoyingTextcorrections=true
useRealNamesForContacts=true
# ---- 3.1.4 Keyboard & Mouse ----
disableNaturalScrolling=true
enableTrackpadClicks=true # <-- only applied on MacBooks (MBA, MBP)
showBatteryPercentage=true # <-- only applied on MacBooks (MBA, MBP)
fasterMouseCursor=true
fnKeyFunctionanlity='emoji' # Modes: off=Do nothing, emoji=Emojis & Symbols, language=Input sources, dictation=Start Dictation
# ---- 3.1.5 Apple Apps ----
useRealNamesForContacts=true
showMusicNextSongPlaying=false
showSubjectInMessagesApp=false

# -- 3.2 macOS Finder customizations --
customizeFinder=true # <-- If false, below settings will have NO effect
Expand All @@ -155,22 +165,23 @@ minimalDock=false
showLibraryFolder=true
addUserApplicationsFolder=true
addUserWebsitesFolder=true
# -- 3.4.1 «Games» folder --
# ---- 3.4.1 «Games» folder ----
addUserGamesFolder=true
useCustomGamesFolderIcon=true # <-- Requires Games Folder (addUserGamesFolder=TRUE)
useCustomGamesFolderIconURL='https://swissmacuser.ch/wp-content/uploads/2021/06/Games-Folder-Icon-macOS-12-Monterey-detailed.png'
# -- 3.4.2 Wallpapers (Desktop Pictures) --
# ---- 3.4.2 Wallpapers (Desktop Pictures) ----
downloadWallpapers=true # <-- Required to download any Wallpapers
dynamicWallpaperExodus=false
dynamicWallpaperFuji=false
dynamicWallpaperISS=false

# -- 3.5 Terminal app settings --
enableTerminalUtf8=true
useCustomTerminalTheme=true # <-- Requires the URL from next line to download .terminal Theme file
useCustomTerminalTheme=false # <-- Requires the URL from next line to download .terminal Theme file
useCustomTerminalThemeURL='https://gist.githubusercontent.com/oliveratgithub/c9dde424966a7b9b5b7e9d1c28bf8f2e/raw/'
useCustomTerminalConfigurations=false # If true, a URL is required to download and apply .zhsrc commands
useCustomTerminalConfigurationsURL=''

# -- 3.6 Application Hardening --
secureSafariBrowser=true
removeTrashbinItemsPeriodically=true # Auto-remove items from Trash after 30 days
Loading

0 comments on commit 5702cfa

Please sign in to comment.