Coder Social home page Coder Social logo

driesvints / dotfiles Goto Github PK

View Code? Open in Web Editor NEW
2.1K 38.0 706.0 5.12 MB

Get started with your own dotfiles.

Home Page: https://driesvints.com/blog/getting-started-with-dotfiles

License: MIT License

Shell 97.58% Ruby 2.42%
dotfiles macos shell homebrew zsh backup brew oh-my-zsh

dotfiles's Introduction

Introduction

This repository serves as my way to help me setup and maintain my Mac. It takes the effort out of installing everything manually. Everything needed to install my preferred setup of macOS is detailed in this readme. Feel free to explore, learn and copy parts for your own dotfiles. Enjoy!

๐Ÿ“– - Read the blog post
๐Ÿ“บ - Watch the screencast on Laracasts
๐Ÿ’ก - Learn how to build your own dotfiles

If you find this repo useful, consider sponsoring me (a little bit)! โค๏ธ

A Fresh macOS Setup

These instructions are for setting up new Mac devices. Instead, if you want to get started building your own dotfiles, you can find those instructions below.

Backup your data

If you're migrating from an existing Mac, you should first make sure to backup all of your existing data. Go through the checklist below to make sure you didn't forget anything before you migrate.

  • Did you commit and push any changes/branches to your git repositories?
  • Did you remember to save all important documents from non-iCloud directories?
  • Did you save all of your work from apps which aren't synced through iCloud?
  • Did you remember to export important data from your local database?
  • Did you update mackup to the latest version and ran mackup backup?

Setting up your Mac

After backing up your old Mac you may now follow these install instructions to setup a new one.

  1. Update macOS to the latest version through system preferences

  2. Setup an SSH key by using one of the two following methods
    2.1. If you use 1Password, install it with the 1Password SSH agent and sync your SSH keys locally.
    2.2. Otherwise generate a new public and private SSH key by running:

    curl https://raw.githubusercontent.com/driesvints/dotfiles/HEAD/ssh.sh | sh -s "<your-email-address>"
  3. Clone this repo to ~/.dotfiles with:

    git clone --recursive [email protected]:driesvints/dotfiles.git ~/.dotfiles
  4. Run the installation with:

    cd ~/.dotfiles && ./fresh.sh
  5. Start Herd.app and run its install process

  6. After mackup is synced with your cloud storage, restore preferences by running mackup restore

  7. Restart your computer to finalize the process

Your Mac is now ready to use!

๐Ÿ’ก You can use a different location than ~/.dotfiles if you want. Make sure you also update the references in the .zshrc and fresh.sh files.

Cleaning your old Mac (optionally)

After you've set up your new Mac you may want to wipe and clean install your old Mac. Follow this article to do that. Remember to backup your data first!

Your Own Dotfiles

Please note that the instructions below assume you already have set up Oh My Zsh so make sure to first install Oh My Zsh before you continue.

If you want to start with your own dotfiles from this setup, it's pretty easy to do so. First of all you'll need to fork this repo. After that you can tweak it the way you want.

Go through the .macos file and adjust the settings to your liking. You can find much more settings at the original script by Mathias Bynens and Kevin Suttle's macOS Defaults project.

Check out the Brewfile file and adjust the apps you want to install for your machine. Use their search page to check if the app you want to install is available.

Check out the aliases.zsh file and add your own aliases. If you need to tweak your $PATH check out the path.zsh file. These files get loaded in because the $ZSH_CUSTOM setting points to the .dotfiles directory. You can adjust the .zshrc file to your liking to tweak your Oh My Zsh setup. More info about how to customize Oh My Zsh can be found here.

When installing these dotfiles for the first time you'll need to backup all of your settings with Mackup. Install Mackup and backup your settings with the commands below. Your settings will be synced to iCloud so you can use them to sync between computers and reinstall them when reinstalling your Mac. If you want to save your settings to a different directory or different storage than iCloud, checkout the documentation. Also make sure your .zshrc file is symlinked from your dotfiles repo to your home directory.

brew install mackup
mackup backup

You can tweak the shell theme, the Oh My Zsh settings and much more. Go through the files in this repo and tweak everything to your liking.

Enjoy your own Dotfiles!

Thanks To...

I first got the idea for starting this project by visiting the GitHub does dotfiles project. Both Zach Holman and Mathias Bynens were great sources of inspiration. Sourabh Bajaj's Mac OS X Setup Guide proved to be invaluable. Thanks to @subnixr for his awesome Zsh theme! Thanks to Caneco for the header in this readme. And lastly, I'd like to thank Emma Fabre for her excellent presentation on Homebrew which made me migrate a lot to a Brewfile and Mackup.

In general, I'd like to thank every single one who open-sources their dotfiles for their effort to contribute something to the open-source community.

dotfiles's People

Contributors

blueclock avatar christophrumpel avatar driesvints avatar imgbotapp avatar lucaslarson avatar michaeldeboey avatar mvdnbrk avatar ovvessem avatar rathesdot avatar robandpdx avatar ryanhanwu avatar tim-mortimer avatar timacdonald avatar xu-minghao317 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotfiles's Issues

Missing pkg-config...?

Seems like you might want to add pkg-config to the Brewfile. I had a failure (on the imagick build/install) on a clean install due to this package missing:

checking for pkg-config... no
pkg-config not found
configure: error: Please reinstall the pkg-config distribution

imagick not found

Warning: 'imagick' formula is unreadable: No available formula with the name "imagick" 
Error: No available formula with the name "imagick" 
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
Error: No similarly named formulae found.
==> Searching taps on GitHub...
==> Searching for similarly named formulae...
==> Searching taps...
Error: No formulae found in taps.
Installing imagick has failed!

.macos Preference Issue

Love your dot files!

I am testing out a few system preference updates, and noticed that defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 didn't seem to work, along with the other App Store lines.

I have it working with defaults write /Library/Preferences/com.apple.SoftwareUpdate.plist CriticalUpdateInstall -bool true however. Is there something I am missing? I ran this line directly in terminal. Also currently on macOS Monterey.

Installing oh-my-zsh after running install.sh

Hey @driesvints, I never installed oh-my-zsh when running a forked version of your dotfiles. Now I'm trying to customize my terminal a bit and am having issues. I went ahead and installed oh-my-zsh (/Users/larry/.oh-my-zsh does exist). I updated my .zshrc, reloaded my terminal, and am not seeing any changes. My fork is based on an older version of your dotfiles which used zplug (doesn't look like you're using it now).

I searched issues and didn't really find anything that helped much. Here is my .zshrc:

export DOTFILES=$HOME/.dotfiles
export ZPLUG_HOME=/usr/local/opt/zplug

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

source $ZPLUG_HOME/init.zsh

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

source $ZSH/oh-my-zsh.sh
source $ZSH/oh-my-zsh.sh
zplug 'zplug/zplug', hook-build:'zplug --self-manage'

# Plugins
zplug "~/.dotfiles", from:local

zplug "zsh-users/zsh-completions"
zplug "zsh-users/zsh-syntax-highlighting", defer:2
zplug "zsh-users/zsh-history-substring-search", defer:3

# Themes
export MNML_INSERT_CHAR="$"
export MNML_PROMPT=(mnml_status mnml_git mnml_keymap)
export MNML_RPROMPT=('mnml_cwd 20')

zplug subnixr/minimal, use:minimal.zsh, from:github, as:theme

zplug load

and a screen shot of my terminal:
image

Do you have any thoughts on what I can do to get oh-my-zsh working? When I initially installed it appeared to load oh-my-zsh but after quitting terminal it will not load again.

Any feedback is greatly appreciated, and thanks for sharing!

UPDATE
Another case of asking too soon.. I just simply copied your current .zshrc and all is well. One thing I am looking for is highlighting commands that are valid vs invalid. I don't remember how I did this before, whether or not it was part of your dotfiles when I forked.

For example, typing a valid command would turn the command green, while invalid commands would be red. This also worked for my aliases.

Do you remember implementing something similar?

Thanks again!

Brewfile taps out of date?

Hey @driesvints , I'm just running your dot files on a new MacBook for the first time and brew is saying the taps/casks have moved:

Error: caskroom/cask was moved. Tap homebrew/cask-cask instead.
Tapping caskroom/cask has failed!
Error: caskroom/eid was moved. Tap homebrew/cask-eid instead.
Tapping caskroom/eid has failed!
Error: caskroom/fonts was moved. Tap homebrew/cask-fonts instead.
Tapping caskroom/fonts has failed!
Error: caskroom/versions was moved. Tap homebrew/cask-versions instead.
Tapping caskroom/versions has failed!

Just thought I'd let you know in case you want to update. Also wondering if I should cancel the install, update, and run again? or just run again after it finishes?

cask-eid was deprecated

Error: homebrew/cask-eid was deprecated.

This tap is now empty and all its contents were either deleted or migrated.
Tapping homebrew/cask-eid has failed!

Error Oh My Zsh plugin and Brew on starting Terminal

Whenever I open the Terminal, it will always throw error like this

/Users/ericknyoto/.zprofile:1: no such file or directory: /opt/homebrew/bin/brew /Users/ericknyoto/.zprofile:2: no such file or directory: /opt/homebrew/bin/brew [oh-my-zsh] plugin 'artisan' not found

.zshrc wasn't modified. It just came from the repo.

I cloned the repo to $HOME/.dotfiles as instructed on the Readme.MD

Is there something I missed?

Warning when installing dot files.

Hi Dries,

Thanks for this wonderful dot files. But when i'm installing these dot files. One error occurs.

Warning: 'stripe/stripe-cli/stripe' formula is unreadable: No available formula with the name "stripe/stripe-cli/stripe" 
Please tap it and then try again: brew tap stripe/stripe-cli

Removing outdated telegram cask

Just to save you from some future issues, in my fork I replaced telegram-desktop with telegram, which is the latest version ๐Ÿค“

Mail is missing

Hi Dries, thanks for sharing your dotfiles. I'm a fairly new Mac user (I probably should have waited to use your dotfiles). Anyhow, I ran your install instructions and most everything seems to be working, with one exception. I was using Mail to access my corporate email through an Exchange server. It seems now that when I open Mail, the program runs, however I do not see my inbox windows.

I have googled a few articles which indicate I should remove some files from my Library folded related to the Mail program. I did this and still cannot get Mail to work properly. Do you have any thoughts?

Thanks again!

Clone laravel repos on install

Clone all OS repos that I maintain automatically upon installation so I can get immediately started with any of them.

Warnings when running PHP

Thanks for this awesome project! I am running into an issue with PHP and extensions like composer/valet from a fresh install. I am sure its something I am doing wrong.

$  composer -v                                                                ~

Warning: Module "imagick" is already loaded in Unknown on line 0

Warning: Module "redis" is already loaded in Unknown on line 0

Warning: Module "imagick" is already loaded in Unknown on line 0
Could not open input file: `/opt/homebrew/bin/composer`

No PHP 8 installed

Hi Dries,

First of all, love the dotfiles! But it doesn't install PHP 8 I fixed this by adding

tap 'shivammathur/php' to the tap section in the brewfile and brew 'shivammathur/php/[email protected]' at the development section

Hope this helps

Git GPG key signing commits breaks after restarting

Hi Dries! ๐Ÿ‘‹

As requested on Twitter, I'm asking you if you could please help me (figure this) out.

I read your article about using a GPG key to sign-off your commits a few years ago and started using the GPG key signoff.

I also used this repo as a base for my own dotfiles repo and saw you're installing gnupg & gpg-suite via brew.

brew 'gnupg'

cask 'gpg-suite'

I've followed GitHub's steps on generating a GPG key and telling Git about it.
Since we don't have a ~/.bash_profile the 5th step of telling Git about it will add the GPG key to ~/.profile:

$ test -r ~/.bash_profile && echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile
$ echo 'export GPG_TTY=$(tty)' >> ~/.profile

Changing the ~/.bash_profile to ~/.zshrc created a export GPG_TTY=$(tty) line in ~/.zshrc

However, when I restarted my laptop and tried to commit a signed commit, I got the following error:

error: gpg failed to sign the data

I tried figuring out myself what caused the problem, but I can't find it.
My Git config includes the user.signingkey and it's a correct one, so that shouldn't be the problem either

Thanks for taking the time to help me out on this one! ๐Ÿ‘Š

Installing stripe has failed!

Hi Dries,

I get this error not sure if this is the fix but changing brew 'stripe' to brew 'stripe/stripe-cli/stripe' fixed it for me.

Read default values of osx before changing

Hello Dries,

I was "studying" your dotfiles, and was wondering if I could get the default osx values before changing.

Say, for example:

defaults read NSGlobalDomain NSTableViewDefaultSizeMode

But seems, at least on Sierra, that most of those parameters does not exist, or might have a different way to get them.

Have you ever tried something similar?

Cheers!

Oh My Zsh gives problems after installing the dot files

Hey Dries,

Thx for publishing your dotfiles. But after the installation it gives some strange issue.

Last login: Thu Oct  3 15:32:03 on ttys001
/Users/timjoosten/.zshrc:source:81: no such file or directory: /Users/driesvints/.oh-my-zsh/oh-my-zsh.sh
MacBook-Pro-van-Tim% 


Source .zshrc every time

Hey Dries,

Thank you so much for the dotfiles.
Issue:
I have to source ~/dotfiles/.zshrc file every time i open iterm otherwise the settings do not take effect.

FYI: symlink present to .zshrc (ln -s $HOME/.dotfiles/.zshrc $HOME/.zshrc) as mentioned in your install.sh file.

Thanks again.

fresh.sh fails after Oh My Zsh installation

Hi Dries,

first of all: thank you very much for the awesome dotfiles.

I am currently facing an issue where the fresh.sh script fails at various point after the installation of ZSH on a new Mac. For example it cannot find the $DOTFILES variable in brew bundle --file $DOTFILES/Brewfile as this is set in .zshrc which is not yet available to the Terminal session. If I close the Terminal and start the script again, everything is working fine as the .zshrc is now loaded.

From my perspective, this error totally makes sense and I was wondering why nobody else seems to face this issue when using your dotfiles. I guess it could be resolved by sourcing the .zshrc before continuing with the script. How are you handling this or am I missing something here?

Thank you very much!

Automate the Github SSH Key Setup

Hi @driesvints

I am currently dealing with dotfiles to set up my MacBook. I stumbled across your repo and would like a tip to automate the setup of the Github SSH key.

Maybe it makes sense to work with the Github CLI, which adds the SSH key automatically with a command.

Of course, you would have to install Homebrew beforehand and then log in via the Github CLI.

Checkout:

Otherwise great work and really helpful.

Different location

Hi, thanks for sharing your dotfiles. Looks very promising your setup.
Is it not possible to clone the repo to another location than ~/.dotfiles?

Mac missing app icons

I would like to inform you that the following command makes the macOS app icons disappear (at least under Majove).

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

I have already found an issue on this. (atomantic/dotfiles#30)

Updating Ohmyzsh

@driesvints First thank you for the repo, I was able to recover a machine with this method and it was painless.

One question though, after restoring, I get the below error when trying to upgrade ohmyzsh.

Any idea of the root cause of this?

Updating Oh My Zsh
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 16 (delta 9), reused 16 (delta 9), pack-reused 0
Unpacking objects: 100% (16/16), 1.99 KiB | 70.00 KiB/s, done.
From https://github.com/ohmyzsh/ohmyzsh
 * branch              master     -> FETCH_HEAD
   2a0ae331..f2a4b2b1  master     -> origin/master
error: 'custom/example.zsh' is beyond a symbolic link
fatal: Unable to process path custom/example.zsh
Cannot save the current worktree state
fatal: Cannot autostash
There was an error updating. Try again later?

Homebrew vs mas

I noticed many of the apps you install with mas are available, for example Sip. Is there an advantage to using one over the other or is it just because it wasn't available at the time when you added it? Thanks

install App Store apps using mas

Been playing with mackup and other dotfiles solutions and your setup looks pretty neat!

I wanted to figure out a better way to deal with App Store apps and ran across mas (https://github.com/mas-cli/mas) - You might be able to use that to automate your apps.md part, I haven't given it a go yet in a scriptable way but I have used it manually a bit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.