{"id":1719,"date":"2024-12-29T20:40:33","date_gmt":"2024-12-29T12:40:33","guid":{"rendered":"https:\/\/www.fanyamin.com\/wordpress\/?p=1719"},"modified":"2024-12-29T20:40:33","modified_gmt":"2024-12-29T12:40:33","slug":"setup-better-env-for-developer","status":"publish","type":"post","link":"https:\/\/www.fanyamin.com\/wordpress\/?p=1719","title":{"rendered":"setup better env for developer"},"content":{"rendered":"<p>Setting up a convenient environment on macOS for developers involves configuring the terminal, installing essential tools, and customizing workflows for efficiency. Here\u2019s a comprehensive guide:<\/p>\n<h2>1. Update macOS and Install Xcode Command Line Tools<\/h2>\n<p>Ensure your macOS is up-to-date:<\/p>\n<pre><code>sudo softwareupdate --install --all<\/code><\/pre>\n<p>Install Xcode Command Line Tools (required for compilers like gcc and tools like git):<\/p>\n<pre><code>xcode-select --install<\/code><\/pre>\n<h2>2. Install a Package Manager: Homebrew<\/h2>\n<p>Homebrew simplifies installing development tools and software:<\/p>\n<pre><code>\/bin\/bash -c &quot;$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/HEAD\/install.sh)&quot;<\/code><\/pre>\n<p>Update Homebrew and verify installation:<\/p>\n<pre><code>brew update &amp;&amp; brew doctor<\/code><\/pre>\n<h2>3. Install Essential Development Tools<\/h2>\n<p>Use Homebrew to install essential tools:<\/p>\n<pre><code>brew install git zsh fzf fd bat lsd htop tmux wget curl tree<\/code><\/pre>\n<p>Recommended tools:<br \/>\n\u2022   fzf: Fuzzy finder for searching commands\/files.<br \/>\n\u2022   bat: A cat alternative with syntax highlighting.<br \/>\n\u2022   lsd: A modern ls replacement with icons and colors.<br \/>\n\u2022   tmux: Terminal multiplexer for session management.<\/p>\n<h2>4. Configure the Terminal<\/h2>\n<p>Install iTerm2<\/p>\n<p>Download and install iTerm2 for a better terminal experience: iTerm2<\/p>\n<p>Customize iTerm2:<br \/>\n\u2022   Use the Preferences panel to set fonts, colors, and keyboard shortcuts.<br \/>\n\u2022   Install a Powerline font for better visual prompts:<\/p>\n<pre><code>brew install --cask font-hack-nerd-font<\/code><\/pre>\n<p>Set the font in iTerm2: Preferences &gt; Profiles &gt; Text &gt; Change Font.<\/p>\n<h2>5. Configure the Shell<\/h2>\n<p>macOS uses Zsh as the default shell. Customize it for efficiency.<\/p>\n<p>Install Oh My Zsh<\/p>\n<pre><code>sh -c &quot;$(curl -fsSL https:\/\/raw.githubusercontent.com\/ohmyzsh\/ohmyzsh\/master\/tools\/install.sh)&quot;<\/code><\/pre>\n<p>Add Plugins<\/p>\n<p>Enable useful plugins in ~\/.zshrc by editing the plugins section:<\/p>\n<p>plugins=(git z zsh-autosuggestions zsh-syntax-highlighting fzf)<\/p>\n<p>Install additional plugins:<br \/>\n\u2022   zsh-autosuggestions: Suggests commands as you type.<\/p>\n<pre><code>brew install zsh-autosuggestions<\/code><\/pre>\n<pre><code>\u2022   zsh-syntax-highlighting: Highlights syntax for easier debugging.<\/code><\/pre>\n<pre><code>brew install zsh-syntax-highlighting\n<\/code><\/pre>\n<p>Set a Custom Theme<\/p>\n<p>Use Powerlevel10k for a highly customizable Zsh prompt:<\/p>\n<pre><code>brew install romkatv\/powerlevel10k\/powerlevel10k\necho &#039;source \/opt\/homebrew\/opt\/powerlevel10k\/powerlevel10k.zsh-theme&#039; &gt;&gt;~\/.zshrc<\/code><\/pre>\n<p>Configure it with:<\/p>\n<pre><code>p10k configure<\/code><\/pre>\n<h2>6. Install Development Environments<\/h2>\n<p>Programming Languages<\/p>\n<p>Install commonly used languages:<br \/>\n\u2022   Python:<\/p>\n<p>brew install python<br \/>\npip3 install --upgrade pip<\/p>\n<pre><code>\u2022   Node.js:<\/code><\/pre>\n<p>brew install node<\/p>\n<pre><code>\u2022   Java:<\/code><\/pre>\n<p>brew install openjdk<\/p>\n<p>Virtual Environments<br \/>\n\u2022   For Python:<\/p>\n<p>pip3 install virtualenv<\/p>\n<pre><code>\u2022   For Node.js:<\/code><\/pre>\n<p>npm install -g n<\/p>\n<p>Version Managers<br \/>\n\u2022   For Python (pyenv):<\/p>\n<p>brew install pyenv<\/p>\n<pre><code>\u2022   For Node.js (nvm):<\/code><\/pre>\n<p>brew install nvm<br \/>\nmkdir ~\/.nvm<br \/>\necho 'export NVM_DIR=&quot;$HOME\/.nvm&quot;' &gt;&gt;~\/.zshrc<br \/>\necho '[ -s &quot;\/opt\/homebrew\/opt\/nvm\/nvm.sh&quot; ] &amp;&amp; . &quot;\/opt\/homebrew\/opt\/nvm\/nvm.sh&quot;' &gt;&gt;~\/.zshrc<\/p>\n<h2>7. Set Up Git<\/h2>\n<p>Configure Git globally:<\/p>\n<p>git config --global user.name &quot;Your Name&quot;<br \/>\ngit config --global user.email &quot;youremail@example.com&quot;<br \/>\ngit config --global core.editor &quot;code --wait&quot;<\/p>\n<p>Generate SSH keys for GitHub:<\/p>\n<p>ssh-keygen -t ed25519 -C &quot;youremail@example.com&quot;<br \/>\nssh-add ~\/.ssh\/id_ed25519<br \/>\ncat ~\/.ssh\/id_ed25519.pub<\/p>\n<p>Add the key to your GitHub account.<\/p>\n<h2>8. Install a Code Editor<\/h2>\n<pre><code>\u2022   Visual Studio Code:<\/code><\/pre>\n<p>brew install --cask visual-studio-code<\/p>\n<p>Add the code command:<\/p>\n<p>ln -s &quot;\/Applications\/Visual Studio Code.app\/Contents\/Resources\/app\/bin\/code&quot; \/usr\/local\/bin\/code<\/p>\n<h2>9. Install Docker<\/h2>\n<p>Install Docker for containerized development:<\/p>\n<p>brew install --cask docker<\/p>\n<h2>10. Enhance Navigation and Productivity<\/h2>\n<pre><code>\u2022   Aliases:<\/code><\/pre>\n<p>Add useful aliases to ~\/.zshrc:<\/p>\n<p>alias ll='ls -lah'<br \/>\nalias gs='git status'<br \/>\nalias gc='git commit -m'<br \/>\nalias ..='cd ..'<br \/>\nalias ...='cd ..\/..'<\/p>\n<pre><code>\u2022   Custom Functions:<\/code><\/pre>\n<p>mkcd() {<br \/>\nmkdir -p &quot;$1&quot; &amp;&amp; cd &quot;$1&quot;<br \/>\n}<\/p>\n<h2>11. Keep the Environment Updated<\/h2>\n<p>Regularly update tools:<\/p>\n<p>brew update &amp;&amp; brew upgrade<\/p>\n<p>With these configurations, your macOS environment will be optimized for productivity, development, and convenience.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting up a convenient environment on macOS for developers involves configuring the terminal, installing essential tools, and customizing workflows for efficiency. Here\u2019s a comprehensive guide: 1. Update macOS and Install Xcode Command Line Tools Ensure your macOS is up-to-date: sudo softwareupdate &#8211;install &#8211;all Install Xcode Command Line Tools (required for compilers like gcc and tools [&hellip;] <a class=\"read-more\" href=\"https:\/\/www.fanyamin.com\/wordpress\/?p=1719\" title=\"Permanent Link to: setup better env for developer\">&rarr;Read&nbsp;more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1719","post","type-post","status-publish","format-standard","hentry","category-5"],"_links":{"self":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1719"}],"collection":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1719"}],"version-history":[{"count":1,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1719\/revisions"}],"predecessor-version":[{"id":1720,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1719\/revisions\/1720"}],"wp:attachment":[{"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fanyamin.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}