Skip to content

Latest commit

 

History

History
328 lines (284 loc) · 6.51 KB

macOS.md

File metadata and controls

328 lines (284 loc) · 6.51 KB

Create disk image from folder:

hdiutil create \
-fs HFS+ \
-srcfolder /path/to/folder \
-volname "Volume Name" \
"image_file.dmg"

Create bootable disk

sudo \
/Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia \
--volume /Volumes/VolumeName \
--applicationpath /Applications/Install\ macOS\ Sierra.app \
--nointeraction

Prevent external disks from sleeping

sudo pmset -a disksleep 0

Add paths to system:

touch ~/.zshrc
nano ~/.zshrc 
export PATH=~/.bin:/usr/local/sbin:$PATH
export HOMEBREW_EDITOR=/usr/bin/nano

Generate and add key

ssh-keygen -t ed25519 -C "[email protected]"
# eval "$(ssh-agent -s)"
# ssh-add ~/.ssh/id_ed25519

Add key to a remote server, and set the permissions

ssh-copy-id user@host

Set defaults of Sublime Text into the ~/Library/Application Support/Sublime Text 3/Packages/User file:

{
	"draw_white_space": "all",
	"ignored_packages":
	[
		"Vintage"
	],
	"open_files_in_new_window": false,
	"scroll_past_end": true,
	"show_encoding": true
}

Reset defaults Launchpad

defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock

Remove ugly blue capslock indicator

sudo defaults write /Library/Preferences/FeatureFlags/Domain/UIKit.plist redesigned_text_cursor -dict-add Enabled -bool NO

Script label to change Finder color tag:

#!/usr/bin/env bash
if [[ $# -le 1 || ! "$1" =~ ^[0-7]$ ]]; then
  echo "Usage: label 01234567 file ..." 1>&2
  exit 1
fi

colors=( 0 2 1 3 6 4 5 7 )
n=${colors[$1]}
shift

osascript - "$@" <<END > /dev/null 2>&1
on run arguments
tell application "Finder"
repeat with f in arguments
set f to (posix file (contents of f) as alias)
set label index of f to $n
end repeat
end tell
end
END
0 = No label
1 = Red
2 = Orange
3 = Yellow
4 = Green
5 = Blue
6 = Purple
7 = Gray

Set volume from terminal

sudo osascript -e "set Volume 10"

List available voices

say -v '?'

Speak

say -v Alex "I'm setting up all the remote connections"

Custom ~/.bin

Symbolic links in ~/.apps/

ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl ~/.bin/sublime
ln -s /Applications/MAMP/Library/bin/mysql ~/.bin/mysql
ln -s /Applications/MAMP/Library/bin/mysqldump ~/.bin/mysqldump
ln -s /Applications/MAMP/bin/php/php7.4.21/bin/php ~/.bin/php

Composer

cd && curl -sS https://getcomposer.org/installer | php
mv composer.phar ~/.bin/composer

RAR

cd ~/.apps
wget https://www.win-rar.com/fileadmin/winrar-versions/rarmacos-arm-612.tar.gz
tar xzf rarmacos-arm-612.tar.gz
rm rarmacos-arm-612.tar.gz
ln -s ~/.apps/rar/rar ~/.bin/rar
ln -s ~/.apps/rar/unrar ~/.bin/unrar

File metadata

# List metadata
xattr <file or folder>
xattr -l <file or folder>

# List files with metadata
ls -l@ <file or folder>

# Remove the metadata
xattr -d "com.apple.lastuseddate#PS" <file or folder>

Figlet

brew install figlet
figlet -I2
figlet -f poison "Rodrigo Polo" 
figlet -f doom "Rodrigo Polo" 
figlet -f epic "Rodrigo Polo" 
figlet -f gothic "Rodrigo Polo" 
figlet -f larry3d "Rodrigo Polo" 
figlet -f rectangles "Rodrigo Polo" 
figlet -f slant "Rodrigo Polo" 
figlet -f smslant "Rodrigo Polo"

Enable color in the Terminal app

Install nano

brew install nano

Edit ~/.nanorc and add:

include "/opt/homebrew/share/nano/*.nanorc" # M1 CPU
include "/usr/local/share/nano/*.nanorc" # For Intel CPU

Change the prompt in ~/.zshrc

PROMPT='%F{cyan}%n@%m %F{yellow}%~ %f%F{green}$%f ' # With user
PROMPT='%F{yellow}%~ %f%F{green}$%f ' # Without user

Enable color support in other apps adding this to ~/.zshrc

# Enable color support
autoload -U colors && colors
export TERM=xterm-256color

# Enable color
alias ls='ls -G'
alias tree='tree -C'
alias grep='grep --color=auto'

# Man pages color settings
export LESS_TERMCAP_mb=$'\e[1;31m'
export LESS_TERMCAP_md=$'\e[1;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[1;44;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;32m'

# Git color settings
git config --global color.ui auto
git config --global color.branch auto
git config --global color.diff auto
git config --global color.status auto

Matrix

cmatrix
unimatrix -s 90

https://github.com/will8211/unimatrix

Weather

Cols 125, rows 40

curl wttr.in
curl wttr.in/:help
curl wttr.in/Guatemala\?format=2
curl wttr.in/Guatemala\?format=3

https://github.com/chubin/wttr.in

Hollywood

docker run --rm -it bcbcarl/hollywood

Utils

brew install \
fastfetch \
ncdu \
btop \
starship \
tmux \
bat \
multitail

Extra sources:

Warp theme ~/.warp/themes/rodrigopolo.yaml

---
background: '#222222' # Terminal background color
accent: '#268bd2' # Accent color for UI elements
foreground: '#839496' # The foreground color
details: darker # Whether the theme is lighter or darker
#cursor: '#d3a964' # The cursor color (optional; defaults to accent color if omitted)
terminal_colors: # Ansi escape colors
  bright:
    black: '#073642'
    blue: '#268bd2'
    cyan: '#2aa198'
    green: '#859900'
    magenta: '#d33682'
    red: '#dc322f'
    white: '#eee8d5'
    yellow: '#b58900'
  normal:
    black: '#333437'
    blue: '#1081d6'
    cyan: '#0f7ddb'
    green: '#1dd361'
    magenta: '#a911eb'
    red: '#de352e'
    white: '#ffffff'
    yellow: '#f3bd09'
name: Rodrigo Polo

Disable starship on Apple Terminal

if [[ $TERM_PROGRAM == "Apple_Terminal" ]]; then
    PROMPT='%B%F{green}%n@%m%b %F{yellow}%~ %f$ '
else
    eval "$(starship init zsh)"
fi

WezTerm settings ~/.wezterm.lua

local wezterm = require 'wezterm'

return {
  font = wezterm.font("FiraCode Nerd Font"),
  font_size = 12.0,
  harfbuzz_features = {"calt=0", "clig=0", "liga=0"},
  initial_cols = 125,
  initial_rows = 40,
  window_background_opacity = 0.8,
  macos_window_background_blur = 20,
  scrollback_lines = 10000,
  enable_tab_bar = true,
  hide_tab_bar_if_only_one_tab = true,
  use_fancy_tab_bar = false,
  window_padding = {
    left = 8,
    right = 8,
    top = 4,
    bottom = 3,
  },
}