Posts

ZFS on Mac

ZFS is cool because it allows pooling of drives (more than one drive per volume), as well as compression and deduplication on the fly. Download and install from: https://openzfsonosx.org/  They do support older Mac OSes as well so that's good news too. To Format a disk, e.g. disk3, you type as follows on Terminal. It should automount after erasing. Bear in mind that if you turn on compression and deduplication the copying process is significantly slower. sudo diskutil eraseDisk HFS+ tempdisk /dev/disk3 sudo zpool create -f -o ashift=12 -O compression=lz4 -O dedup=on mypool /dev/disk3

Convert MKV to MOV or MP4 to MOV

# MKV to MP4     ffmpeg -i movie-file.mkv  -codec copy movie-file.mp4 # MKV to MOV (compressed)     ffmpeg -i movie-file.mkv  -f mov movie-file.mov # MP4 to MOV (compressed)     ffmpeg -i movie-file.mp4  -f mov movie-file.mov # MKV to MOV (raw/uncompressed: warning huge file):     ffmpeg -i movie-file.mkv -c:v prores_ks -profile:v 3 -c:a pcm_s24le movie-file.mov

applescript to bulk convert Pages files to PDF

 Not my script, but it works: paste this into Script Editor, and choose save as app: use scripting additions property valid_kind : {"Pages Document"} property imageBest : false property fileCnt : (0 as integer ) -- property dx_icon : "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MultipleItemsIcon.icns" on open dropped_items tell application "Pages" to set itsversion to its version considering numeric strings if itsversion > "5.6" then set imageBest to true end considering repeat with anItem in dropped_items try tell application "Finder" if kind of anItem is equal to "Folder" then set docList to ( every item in entire contents of folder anItem ¬ whose kind is in valid_kind ) as alias list repeat with afile in docList my export_file ( afile ) end repeat

Converting media formats on the command line

1. Install Homebrew 2. Install ImageMagic and FFMpeg:      brew install ImageMagick      brew install ffmpeg 3.  Where  $i  is the original name and  $nn  is the new name: Animated gif to mp4: ffmpeg -i $i -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" $nn.mp4 WAV to mp3: In case you have to deal with windows 3.11 users. Just kidding, any windows users. ffmpeg -i $i -vn -ar 44100 -ac 2 -b:a 192k $nn.mp3 Any video to mp4: This is useful if you get MOV files from your phone as they are 3x bigger than mp4: ffmpeg -i $i $-vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 $nn.mp4 PNG to jpg: This is useful if you get lots of screenshots on your phone as the screenshots are 10x bigger than jpg:     convert $i $nn.jpg

Mark an app as secure to run on Mac on command line

 sudo xattr -r -d com.apple.quarantine /Applications/Theapp.app 

How to format/partition a disk from the command line

 diskutil partitionDisk /dev/disk3 GPT jhfs+ foo 10g jhfs+ bar 10g

Boot MacOS under VirtualBox

  Introduction The following steps are needed to boot Mac OS under VirtualBox. I tested it using Mac OS X 10.13. I can't guarantee this works. You'll need a source/original mac to copy the OS install. Probably Apple won't approve of this because they want you to buy their original hardware, but sometimes you need hosted VMs in the cloud or similar, and they don't really offer that. You can see this page for more:  https://johnsmactips.blogspot.com/2021/02/managing-virtualbox-on-command-line.html Steps Commands below are typed in a command line like the Terminal. 1. On a Mac, do this to download an installer disk: softwareupdate --fetch-full-installer --full-installer-version  ... OR download from the app store. If the operating system you want to install is out of date, ie if the Mac tells you the installer is damaged, set your Mac date and time to however many years ago that operating system came out, and turn of automatic date and time in the date and time system pref