{"id":18445715,"url":"https://github.com/voronenko/macfiles","last_synced_at":"2025-07-06T01:04:13.381Z","repository":{"id":92366561,"uuid":"423911514","full_name":"Voronenko/macfiles","owner":"Voronenko","description":"Mac optimized dotfiles","archived":false,"fork":false,"pushed_at":"2025-03-24T13:12:57.000Z","size":399,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T05:37:12.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Voronenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-02T16:06:10.000Z","updated_at":"2025-03-24T13:13:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"e06debc6-97fe-4df9-aa0b-5837c49fe09d","html_url":"https://github.com/Voronenko/macfiles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Voronenko/macfiles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fmacfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fmacfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fmacfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fmacfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Voronenko","download_url":"https://codeload.github.com/Voronenko/macfiles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Voronenko%2Fmacfiles/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263833416,"owners_count":23517373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T07:06:57.776Z","updated_at":"2025-07-06T01:04:13.348Z","avatar_url":"https://github.com/Voronenko.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"macfiles\n========\n\nMod of my usual linux environment over mac M1 favor\n\nSo, to recap, the install script will:\n\n* Back up any existing dotfiles in your home directory to ~/dotfiles_old/\n* Create symlinks to the dotfiles in ~/dotfiles/ in your home directory\n* Clone the oh-my-zsh repository from my GitHub (for use with zsh)\n* Check to see if zsh is installed, if it isn't, try to install it.\n* If zsh is installed, run a chsh -s to set it as the default shell.\n\n## Some macfiles perks (but not all)\n\n### fzf\n\n`COMMAND [DIRECTORY/][FUZZY_PATTERN]**\u003cTAB\u003e`  - lookup file/folder\n\n`kill -9 \u003cTAB\u003e`  - lookup process\n\n`ssh **\u003cTAB\u003e` - lookup host from ~/.ssh/confog\n\noperate with envvars\n\n```sh\nunset **\u003cTAB\u003e\nexport **\u003cTAB\u003e\nunalias **\u003cTAB\u003e\n```\n\nas a part of helper for docker \u003chttps://github.com/MartinRamm/fzf-docker.git\u003e\n\n| command | description                                        | fzf mode | command arguments (optional)                                             |\n|---------|----------------------------------------------------|-----------|--------------------------------------------------------------------|\n| dr      | docker restart \u0026\u0026 open logs (in follow mode)       | multiple  |                                                                    |\n| dl      | docker logs (in follow mode)                       | multiple  | time interval - e.g.: `1m` for 1 minute - (defaults to all logs)   |\n| dla     | docker logs (in follow mode) all containers        |           | time interval - e.g.: `1m` for 1 minute - (defaults to all logs)   |\n| de      | docker exec in interactive mode                    | single    | command to exec (default - see below)                              |\n| drm     | docker remove container (with force)               | multiple  |                                                                    |\n| drma    | docker remove all containers (with force)          |           |                                                                    |\n| ds      | docker stop                                        | multiple  |                                                                    |\n| dsa     | docker stop all running containers                 |           |                                                                    |\n| dsrm    | docker stop and remove container                   | multiple  |                                                                    |\n| dsrma   | docker stop and remove all container               |           |                                                                    |\n| dk      | docker kill                                        | multiple  |                                                                    |\n| dka     | docker kill all containers                         |           |                                                                    |\n| dkrm    | docker kill and remove container                   | multiple  |                                                                    |\n| dkrma   | docker kill and remove all container               |           |                                                                    |\n| drmi    | docker remove image (with force)                   | multiple  |                                                                    |\n| drmia   | docker remove all images (with force)              |           |                                                                    |\n| dclean  | `dsrma` and `drmia`                                |           |                                                                    |\n\n\n### Misc console helpers\n\n`z \u003ctab\u003e`  - quickly change to most often used dir with cd\n\n`ga` Interactive git add selector\n\n`glo` Interactive git log viewer\n\n`gi` Interactive .gitignore generator\n\n`gd` Interactive git diff viewer\n\n`grh` Interactive git reset HEAD \u003cfile\u003e selector\n\n`gcf` Interactive git checkout \u003cfile\u003e selector\n\n`gss` Interactive git stash viewer\n\n`gclean` Interactive git clean selector\n\n`ec2ssh` - lookup and template ssh connection to machines you want to connect\n\n`ec2ssm` - lookup instances to connect using aws ssm\n\n\n### Folder specific environment with direnv\n\nIf you have direnv tool installed, `.envrc` start to get supported.\n\n```\nif [[ -f /usr/bin/direnv ]]; then\n# direnv\neval \"$(direnv hook zsh)\"\nfi\n```\n\nQuick note on getting \"merged\" environments: placing `source_env` directive into `.envrc`\nallows that effect. In other case, other environment variables will be uploaded.\n\n```\nsource_env ..\n```\n\nAlso you might use custom instruction \"inherit_env\", which will ensure, that all variables from parent .envrc will be loaded.\n\nIf you also make use of hashicorp vault for secrets storage,\nyou can use following workaround with direnv:\n\n```envrc\nPROJECT=SOMEPROJECT\nexport AWS_ACCESS_KEY_ID=$(vault read -field \"value\" secret/$PROJECT/aws/AWS_ACCESS_KEY_ID)\nexport AWS_SECRET_ACCESS_KEY=$(vault read -field \"value\" secret/$PROJECT/aws/AWS_SECRET_ACCESS_KEY)\nexport AWS_DEFAULT_REGION=us-east-1\n```\n\nIf you use pass backend, you can also use it like below\n\n```envrc\nPROJECT=SOMEPROJECT\nexport AWS_ACCESS_KEY_ID=$(pass show aws/$PROJECT/AWS_ACCESS_KEY_ID)\nexport AWS_SECRET_ACCESS_KEY=$(pass show aws/$PROJECT/AWS_SECRET_ACCESS_KEY)\nexport AWS_DEFAULT_REGION=us-east-1\n```\n\n### NodeJS development?\n\nIf detected, nvm is loaded and per project `.nvmrc` is supported to switch node version in console.\n\n```sh\nif [[ -f ~/.nvm/nvm.sh ]]; then\n\nsource ~/.nvm/nvm.sh\n\n# place this after nvm initialization!\nautoload -U add-zsh-hook\nload-nvmrc() {\n  local node_version=\"$(nvm version)\"\n  local nvmrc_path=\"$(nvm_find_nvmrc)\"\n\n  if [ -n \"$nvmrc_path\" ]; then\n    local nvmrc_node_version=$(nvm version \"$(cat \"${nvmrc_path}\")\")\n\n    if [ \"$nvmrc_node_version\" = \"N/A\" ]; then\n      nvm install\n    elif [ \"$nvmrc_node_version\" != \"$node_version\" ]; then\n      nvm use\n    fi\n  elif [ \"$node_version\" != \"$(nvm version default)\" ]; then\n    echo \"Reverting to nvm default version\"\n    nvm use default\n  fi\n}\nadd-zsh-hook chpwd load-nvmrc\nload-nvmrc\n\nfi\n```\n\n### Python development?\n\nmacfiles are optimized specifically for use with conda and pyenv\n\n```zshrc\n# \u003e\u003e\u003e conda initialize \u003e\u003e\u003e\n# !! Contents within this block are managed by 'conda init' !!\n__conda_setup=\"$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2\u003e /dev/null)\"\nif [ $? -eq 0 ]; then\n    eval \"$__conda_setup\"\nelse\n    if [ -f \"/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh\" ]; then\n        . \"/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh\"\n    else\n        export PATH=\"/opt/homebrew/Caskroom/miniconda/base/bin:$PATH\"\n    fi\nfi\nunset __conda_setup\n# \u003c\u003c\u003c conda initialize \u003c\u003c\u003c\n\n\n#TODO: consider moving to pyenv plugin\nif [[ -d ~/.pyenv ]]; then\nexport PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA=\"openssl@3\"\nexport PYENV_ROOT=\"$(pyenv root)\"\ncommand -v pyenv \u003e/dev/null || export PATH=\"$PYENV_ROOT/bin:$PATH\"\neval \"$(pyenv init --path)\"\neval \"$(pyenv init -)\"\neval \"$(pyenv virtualenv-init -)\"\nfi\n```\n\n\n## Anything locally specific?\n\nAdd .zshrc.local - it gets parsed.\n\n```sh\nif [[ -f ${HOME}/.zshrc.local ]]; then source ${HOME}/.zshrc.local; fi\n```\n\nsee section on pyenv installation at the bottom of the file\n\n\n\n## Automatic tool version switching\n\n### .terraform-version\n\nAs your projects are based on different terraform versions, makes sense to isolate your terraform\nversion exactly as you isolate python, nodejs, go versions.\n\nThus if .terraform-version is detected in $HOME, it is assumed that this host has preference of using\nterraform versions via tfenv, rather than using binary from ~/dotfiles/bin.\n\nTerraform version is detected using following logic: if no parameter is passed, the version to use is\nresolved automatically via .terraform-version files or TFENV_TERRAFORM_VERSION environment variable\n(TFENV_TERRAFORM_VERSION takes precedence), defaulting to 'latest' if none are found.\n\nThus good idea is to set default version of the terraform.\n\n### .python-version\n\nAutomatically activates pyenv environmet for the version specified in .python-version file.\n\n### .nvmrc\n\nAutomatically activates nvm environmet for the version specified in .nvmrc file.\n\n### .java-version\n\nAutomatically activates java version specified in .java-version file using jenv, if present\n\n\n\n\n\n# Troubleshooting\n\n## pyenv installation problems\n\nIf your local setup is per `macfiles`, your pyenv installation should work out of the box with:\n\n```\ninstall-pyenv:\n brew reinstall ca-certificates\n brew install openssl readline sqlite3 xz zlib tcl-tk@8 libb2\n brew install pyenv\n echo \"Installing virtualenv plugin\"\n brew install pyenv-virtualenv\n echo \"Usage: pyenv virtualenv 3.9.15 name-of-virtual-env\"\n```\n\nThis goes in line with official pyenv installation instructions.\n\u003chttps://github.com/pyenv/pyenv/wiki#suggested-build-environment\u003e =\u003e  \u003chttps://github.com/pyenv/pyenv?tab=readme-ov-file#b-set-up-your-shell-environment-for-pyenv\u003e =\u003e  \u003chttps://github.com/pyenv/pyenv/wiki#suggested-build-environment\u003e\n\n\n\nIf during installation you face one of the following errors:\n\n### Security certificate problem\n\nEnsure you've instructed pyenv to use openssl v3 instead of v1, as homebrew openssl v1 is badly broken at least on arm64 macs.\n\n`export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA=\"openssl@3\"`\n\nIn macfiles it is already addressed\n\n```\nif [[ -d ~/.pyenv ]]; then\nexport PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA=\"openssl@3\"\nexport PYENV_ROOT=\"$(pyenv root)\"\ncommand -v pyenv \u003e/dev/null || export PATH=\"$PYENV_ROOT/bin:$PATH\"\neval \"$(pyenv init --path)\"\neval \"$(pyenv init -)\"\neval \"$(pyenv virtualenv-init -)\"\nfi\n```\n\n### Linking errors during python version installation, including DYLD_LIBRARY_PATH errors\n\nIf python version installation fails with error messages like:\n\n```txt\nDYLD_LIBRARY_PATH=/var/folders/dm/s9twt_h92t15b27mn940zdqw0000gp/T/python-build.20250324114735.79587/Python-3.9.15 ./python.exe -E -m ensurepip \\\n   $ensurepip --root=/ ; \\\n fi\ndyld[93892]: missing symbol called\n```\n\nor\n\n```txt\nUndefined symbols for architecture arm64:\n \"_libintl_bindtextdomain\", referenced from:\n   __locale_bindtextdomain in _localemodule.o\n   __locale_bindtextdomain in _localemodule.o\n \"_libintl_dcgettext\", referenced from:\n   __locale_dcgettext in _localemodule.o\n \"_libintl_dgettext\", referenced from:\n   __locale_dgettext in _localemodule.o\n \"_libintl_gettext\", referenced from:\n   __locale_gettext in _localemodule.o\n \"_libintl_setlocale\", referenced from:\n   __locale_setlocale in _localemodule.o\n   __locale_setlocale in _localemodule.o\n   __locale_localeconv in _localemodule.o\n   __locale_localeconv in _localemodule.o\n   __locale_localeconv in _localemodule.o\n   __locale_localeconv in _localemodule.o\n \"_libintl_textdomain\", referenced from:\n   __locale_textdomain in _localemodule.o\nld: symbol(s) not found for architecture arm64\nclang: error: linker command failed with exit code 1 (use -v to see invocation)\nmake: *** [Programs/_freeze_module] Error 1\nmake: *** Waiting for unfinished jobs....\n```\n\nMost likely reason on macOS running on M1-M4 chips is that you have ugly mix of homebrew for arm and x86 architectures.\n(Don't ask me how you did it, perhaps you haven't used `macfiles` from the start)\n\nAnd reliable way to fix that might be:\n\n(A)\n\nIn zshrc, like `macfiles` does, ensure you have forced arm64 version of the homebrew in terminal sessions\n```zshrc\neval $(/opt/homebrew/bin/brew shellenv)\n```\n\n(B) You might have mix of the libraries in x86 location (`ls /usr/local/lib/libint*`) and arm64 location (`ls /opt/homebrew/lib/libint*`).\nAs you are working or arm machine, you should have all necessary libraries in arm64 location.\n\nIf, saying, you observe situation like\n\n```shell\nls /usr/local/lib/libint*\n/usr/local/lib/libintl.8.dylib /usr/local/lib/libintl.dylib\n/usr/local/lib/libintl.a\n\nls /opt/homebrew/lib/libint*\nzsh: no matches found: /opt/homebrew/lib/libint*\n\n```\n\nThis is exactly scenario: libraries are installed for the wrong architecture.\n\nApply (A), open fresh shell.\nReinstall typical python dependencies for arm64 architecture.\n\n```shell\nbrew install gettext\nbrew link gettext --force\n\nbrew install openssl readline sqlite3 xz zlib tcl-tk@8 libb2\n\nbrew install ncurses\n```\n\nAfter that you should be able to install python versions with pyenv for arm64 architecture.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fmacfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoronenko%2Fmacfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoronenko%2Fmacfiles/lists"}