Giter Site home page Giter Site logo

dotfiles's Introduction

Dotfiles

My OSX / Ubuntu dotfiles.

About this project

I've been using bash on-and-off for a long time (since Slackware Linux was distributed on 1.44MB floppy disks). In all that time, every time I've set up a new Linux or OS X machine, I've copied over my .bashrc file and my ~/bin folder to each machine manually. And I've never done a very good job of actually maintaining these files. It's been a total mess.

I finally decided that I wanted to be able to execute a single command to "bootstrap" a new system to pull down all of my dotfiles and configs, as well as install all the tools I commonly use. In addition, I wanted to be able to re-execute that command at any time to synchronize anything that might have changed. Finally, I wanted to make it easy to re-integrate changes back in, so that other machines could be updated.

That command is dotfiles, and this is my "dotfiles" Git repo.

How the "dotfiles" command works

When dotfiles is run for the first time, it does a few things:

  1. In Ubuntu, Git is installed if necessary via APT (it's already there in OSX).
  2. This repo is cloned into your user directory, under ~/.dotfiles.
  3. Files in /copy are copied into ~/. (read more)
  4. Files in /link are symlinked into ~/. (read more)
  5. You are prompted to choose scripts in /init to be executed. The installer attempts to only select relevant scripts, based on the detected OS and the script filename.
  6. Your chosen init scripts are executed (in alphanumeric order, hence the funky names). (read more)

On subsequent runs, step 1 is skipped, step 2 just updates the already-existing repo, and step 5 remembers what you selected the last time. The other steps are the same.

Other subdirectories

  • The /backups directory gets created when necessary. Any files in ~/ that would have been overwritten by files in /copy or /link get backed up there.
  • The /bin directory contains executable shell scripts (including the dotfiles script) and symlinks to executable shell scripts. This directory is added to the path.
  • The /caches directory contains cached files, used by some scripts or functions.
  • The /conf directory just exists. If a config file doesn't need to go in ~/, reference it from the /conf directory.
  • The /source directory contains files that are sourced whenever a new shell is opened (in alphanumeric order, hence the funky names).
  • The /test directory contains unit tests for especially complicated bash functions.
  • The /vendor directory contains third-party libraries.

The "copy" step

Any file in the /copy subdirectory will be copied into ~/. Any file that needs to be modified with personal information (like copy/.gitconfig which contains an email address and private key) should be copied into ~/. Because the file you'll be editing is no longer in ~/.dotfiles, it's less likely to be accidentally committed into your public dotfiles repo.

The "link" step

Any file in the /link subdirectory gets symlinked into ~/ with ln -s. Edit one or the other, and you change the file in both places. Don't link files containing sensitive data, or you might accidentally commit that data! If you're linking a directory that might contain sensitive data (like ~/.ssh) add the sensitive files to your .gitignore file!

The "init" step

Scripts in the /init subdirectory will be executed. A whole bunch of things will be installed, but only if they aren't already.

OS X

Ubuntu

Both

Hacking my dotfiles

Because the dotfiles script is completely self-contained, you should be able to delete everything else from your dotfiles repo fork, and it will still work. The only thing it really cares about are the /copy, /link and /init subdirectories, which will be ignored if they are empty or don't exist.

If you modify things and notice a bug or an improvement, file an issue or a pull request and let me know.

Also, before installing, be sure to read my gently-worded note.

Installation

OS X Notes

You need to have XCode or, at the very minimum, the XCode Command Line Tools, which are available as a much smaller download.

The easiest way to install the XCode Command Line Tools in OSX 10.9+ is to open up a terminal, type xcode-select --install and follow the prompts.

Tested in OSX 10.15

Ubuntu Notes

You might want to set up your ubuntu server like I do it, but then again, you might not.

Either way, you should at least update/upgrade APT with sudo apt-get -qq update && sudo apt-get -qq dist-upgrade first.

Tested in Ubuntu 14.04 LTS

Heed this critically important warning before you install

If you're not me, please do not install dotfiles directly from this repo!

Why? Because I often completely break this repo while updating. Which means that if I do that and you run the dotfiles command, your home directory will burst into flames, and you'll have to go buy a new computer. No, not really, but it will be very messy.

Actual installation (for you)

  1. Read my gently-worded note
  2. Fork this repo
  3. Open a terminal/shell and do this (change cowboy and master as appropriate):

Ubuntu

export DOTFILES_GH_USER=cowboy
export DOTFILES_GH_BRANCH=master
bash -c "$(wget -qO- https://raw.github.com/$DOTFILES_GH_USER/dotfiles/$DOTFILES_GH_BRANCH/bin/dotfiles)" && source ~/.bashrc

macOS

export DOTFILES_GH_USER=cowboy
export DOTFILES_GH_BRANCH=master
bash -c "$(curl -fsSL https://raw.github.com/$DOTFILES_GH_USER/dotfiles/$DOTFILES_GH_BRANCH/bin/dotfiles)" && source ~/.bashrc

Since you'll be using the dotfiles command on subsequent runs, you'll only have to set the DOTFILES_GH_USER variable for the initial install, but if you have a custom branch, you will need to export DOTFILES_GH_BRANCH for subsequent runs.

There's a lot of stuff that requires admin access via sudo, so be warned that you might need to enter your password here or there.

Actual installation (for me)

Ubuntu

bash -c "$(wget -qO- https://bit.ly/cowboy-dotfiles)" && source ~/.bashrc

macOS

bash -c "$(curl -fsSL https://bit.ly/cowboy-dotfiles)" && source ~/.bashrc

Aliases and Functions

To keep things easy, the ~/.bashrc and ~/.bash_profile files are extremely simple, and should never need to be modified. Instead, add your aliases, functions, settings, etc into one of the files in the source subdirectory, or add a new file. They're all automatically sourced when a new shell is opened. Take a look, I have a lot of aliases and functions. I even have a fancy prompt that shows the current directory, time and current git/svn repo status.

Scripts

In addition to the aforementioned dotfiles script, there are a few other bin scripts. This includes nave, which is a git submodule.

  • dotfiles - (re)initialize dotfiles. It might ask for your password (for sudo).
  • src - (re)source all files in /source directory
  • Look through the bin subdirectory for a few more.

Prompt

I think my bash prompt is awesome. It shows git and svn repo status, a timestamp, error exit codes, and even changes color depending on how you've logged in.

Git repos display as [branch:flags] where flags are:

? untracked files
! changed (but unstaged) files
+ staged files

SVN repos display as [rev1:rev2] where rev1 and rev2 are:

rev1 last changed revision
rev2 revision

Check it out:

My awesome bash prompt

Inspiration

https://github.com/gf3/dotfiles
https://github.com/mathiasbynens/dotfiles
(and 15+ years of accumulated crap)

License

Copyright (c) 2014 "Cowboy" Ben Alman
Licensed under the MIT license.
http://benalman.com/about/license/

dotfiles's People

Contributors

c17r avatar cowboy avatar kevinreddot avatar leoj3n avatar sapid avatar travi avatar wesedens 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotfiles's Issues

Symbolic link to powerline config

I couldn't figure out how to make the powerline configs work until I did this:

ln -s ~/.dotfiles/config/powerline ~/.config/powerline

Maybe you could add that symlink in the script.

Thanks for your awesome dotfiles!!!

Issue setting up dotfiles

So I'm trying to setup the dot files. I've forked it out. But there are some errors that are showing

Sourcing 30_osx_homebrew_recipes.sh
couldn't understand kern.osversion `14.0.0'

Sourcing 50_node.sh
/Users/ezjacob/.dotfiles/source/50_node.sh: line 19: nave: command not found

Installing Node.js stable
bash: line 22: nave: command not found
/Users/ezjacob/.dotfiles/source/50_node.sh: line 9: nave: command not found
ln: /Users/ezjacob/.nave/installed/default/stable: File exists
Nave default set to stable

Updating npm
bash: line 34: npm: command not found
bash: line 35: npm: command not found
bash: line 35: pushd: /lib/node_modules: No such file or directory
bash: line 35: popd: directory stack empty

Installing Npm modules: grunt-cli grunt-init linken bower node-inspector yo
bash: line 39: npm: command not found

Sourcing 50_osx_fonts.sh

Sourcing 50_ruby.sh

Installing Ruby versions: 2.1.3
rbenv: no such command `install'
rbenv: version `2.1.3' not installed

Sourcing 50_vim.sh

All done!
-bash: /Users/ezjacob/.dotfiles/vendor/z/z.sh: No such file or directory

Any thoughts on whats happening?

The usage of the main title "Ubuntu" remains included in http://bit/ly/ubuntubounties list unfortunately.

Hi there,

First of all we mean you no harm (Ahem :)

Secondly we wondered if you'd do us a massive favour concerning your use of the word 'Ubuntu' in the list in the 'Projects' column of this link http://bit.ly/ubuntubounties .

You see that your project is included in the main projects page of the only 'Official List' we have of Ubuntu Bounties, and we were really hopeful in asking you to make a certain change to your use of the word 'Ubuntu' so that we could have a complete list of the main 'Core' Ubuntu projects on that page.

To remedy this I would ask that you change the 'cowboy/dotfiles' github description from:
" My OS X / Ubuntu dotfiles."
to that of
"My OSX&Ubuntu dotfiles."

... which reads exactly the same, but allows for non-inclusion of the project into the search page results.

Obviously, we don't mean to tarnish your project, but we do need to produce the right results for the Ubuntu project as a whole, which I'm sure as an Ubuntu user you will support.

If you would prefer to create an issue and tell us under-here which temporary issue you would like to be funded then, we would gladly carry out that request. It's just unfortunate that your project happens to be in the 'way' of getting a full sheet of Ubuntu projects as you can see.

**Alternatively, I would ask that you suggest (to myself, below) an Ubuntu bounty that you'd like funding on your behalf, and I'd gladly, me personally, shall put $25 towards that project, and that specific bug that you say I should award.

Thank-you for your kind understanding in this matter.

3rdwiki.

Git status function no longer works with latest version of Git

I updated version 1.8.5 of Git via Homebrew and the git status function no longer reports the status in the prompt. Running brew uninstall git and using the version that came with Xcode works fine.

Any obvious reason this function would break in 1.8.5?

Breaks Authorized Keys on EC2

If you run the install on an EC2 instance the authorized keys are broken. I have even backed up the authorized_keys file and moved it back still no luck. Any thoughts?

can't edit commands from history

Using fancy terminal on Ubuntu.
Commands from history (with "up" arrow key) can not be edited. Specifically, backspace does not work

automatic execution of files in "source"

Hi,

thank you for your great scripts and configurations, and the proposed concept of managing them. I am currently using a small subset of the folders (init, copy and link) in order to setup Raspbian systems. It works great.

Just one question I have: Although the files within the subfolders COPY, LINK and INIT are handled as expected, the files in the SOURCE subfolder seem not to be. For example, I would like to see the prompt change according to the file source/50_prompt.sh . As the file bin/dotfiles does not execute / handle the SOURCE files as done for COPY, LINK and INIT, where (in which of the repository files) do I find the line of code which executes them?

Thank you very much.

Shell Prompt breaks "New tabs open" osx feature

Opening a new Terminal Tab, or Window in OSX can be configured to start in CWD or HOME:

osx terminal startup configuration

Using the "Shell Prompt" script will break that functionality and new Tabs and Windows will always open at HOME.

Can't disable keyring pop-ups on Ubuntu 16.04

Whenever I log into Ubuntu and open Chrome, I'm prompted to enter my password unlock a keyring 2-4 times. If open the Passwords and Keys app, I have multiple folders (somemimes 20+) named Login, most of which are empty or have less than three keys. It doesn't matter if I delete these folders because new ones always appear over time. It's like something in the dotfiles is automatically creating these folders, which I keep having to unlock. I've Googled this issue and the normal fixes don't work. How can i resolve this issue? Having to enter my password multiple times to use Chrome is cumbersome.

Setting $EDITOR on Ubuntu

So, I had been setting export EDITOR=subl & export VISUAL=subl in .profile, .bashrc & .bash_profile in hopes that the EDITOR would change to sublime text, then I realized that you were sourcing them from 50_editor.sh.

As someone who really doesn't know a lick of shell scripting, I assume that you set Sublime text for OSX ( the "OSTYPE" = ^darwin condition check) & any of nano pico vi vim for others. I'd like to add sublime text to the mix, so do I just add subl to that list as well?

or do I just rewrite that line as export EDITOR='subl -w'

Apologies in advance if this is an inane question.

How to manage the ssh config

in my ssh config file, i have hosts, such as:

Host foo
    HostName    127.0.0.1
    user        lucky

so I can ssh into a server simply by doing ssh foo

but this repo includes the config file. I do not want to. I can manually remove it using git rm --cached but i was hoping there was a better way you could think of.

I couldnt find a better location to post this. Thanks.

Uninstall unneeded programs

Cowboy please tell me, how i can remove programs installed with your .dotfiles?
Ex: ReaMote64, REAPER64, Moom...etc

How to uninstall on Ubuntu?

I installed the dotfiles on Ubuntu and got something different from what I was expecting. I'd like to uninstall and try another set of dotfiles. How can I do this?

how to store secrets outside of .dotfiles?

Maybe I am missing the obvious. but where do I store secret keys for AWS, Heroku, etc and still have them loaded via dotfiles?

What would be my prefered way of doing that?

Need official GCC compiler to install ruby 1.9.2

If you still want to install Ruby 1.9.2, you'll need to add a step to install the official GCC compiler as a prerequisite. That installer can't use the XCode command line tools.

Installing Ruby versions: 1.9.2-p290

ERROR: This package must be compiled with GCC, but ruby-build couldn't
find a suitable gcc executable on your system. Please install GCC
and try again.

DETAILS: Apple no longer includes the official GCC compiler with Xcode
as of version 4.2. Instead, the gcc executable is a symlink to
llvm-gcc, a modified version of GCC which outputs LLVM bytecode.

For most programs the llvm-gcc compiler works fine. However,
versions of Ruby older than 1.9.3-p125 are incompatible with
llvm-gcc. To build older versions of Ruby you must have the official
GCC compiler installed on your system.

TO FIX THE PROBLEM: Install the official GCC compiler using these
packages: https://github.com/kennethreitz/osx-gcc-installer/downloads

You will need to install the official GCC compiler to build older
versions of Ruby even if you have installed Apple's Command Line Tools
for Xcode package. The Command Line Tools for Xcode package only
includes llvm-gcc.

BUILD FAILED

I don't know why you'd still want to be installing 1.9.2 with 2 being the stable branch (and when you're already installing 1.9.3) though, so you probably just want to (or have already) remove that version from your list of versions to install on a fresh machine.

Initial install, sudo without password

Add to the docs or README, maybe:

  1. sudo visudo (enter password when asked)
    • Type /%adm<Enter>3fAiNOPASSWD:<Esc>:wq<Enter>
    • Before: %admin ALL=(ALL) ALL
    • After: %admin ALL=(ALL) NOPASSWD:ALL
  2. Install dotfiles per README
  3. sudo visudo
    • Type /%adm<Enter>fNdf:<Esc>:wq<Enter>
    • (revert previous change)

(This assumes the default new system visudo configuration)

Change setup of origin to comply with github push requests

The current setting of origin in bin/dotfiles line 288 is:

git clone --recursive git://github.com/${github_user:-cowboy}/dotfiles.git $DOTFILES

Yesterday I ran into an issue with this. I could not push to github.com with the generated .git/config.

The suggested form for cloning is:

git clone [email protected]:cowboy/dotfiles.git

This should setup .git/config right.

Just want to announce. Will send a pull request once I got some routine with github.com, and dived into this a little deeper.

regards

from Elmar to Alman

P.S.: Yes, I tried with my own fork of the repo.

Default to not run init scripts after first run

I take the concept init scripts as being scripts that are run only when something needs to be setup. I've noticed that your script automatically wants to run any init script by default every time. Is there a way to make init scripts not default to be run after the first run? Example: I run dotfiles for the first time and all the init scripts default to run but then every subsequent run afterwards defaults to not run since everything doesn't need to be run every time. Thanks.

Change .gitignore_global path

excludesfile = /Users/cowboy/.dotfiles/conf/.gitignore_global

should be

excludesfile = ~/.gitignore_global

And that file should be moved to link folder.

Terminal crashes when using 'cd'

iTerm and built in terminal break on these commands with no errors:

cd /
cd /any/path/starting/with/slash
cd ~ && cd .. && cd .. # breaks when I get to the / path

and there were a few others. I have tried disabling things but cannot locate what is causing the issue so far.

Add prompt screenshot

I even have a fancy prompt that shows the current directory, time and current git/svn repo status.

POIDH.

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.