20220125のMacに関する記事は2件です。

Ruby入門 Ruby3導入方法 for mac (2022) 環境構築

新しいMacbookにRubyを導入する工程をまとめます。 動作環境 MacBook    (Retina, 12-inch, 2017) MacOS     Monterey 12.1 Processor    1.4 GHz Dual-Core Intel Core i7 Memory     16 GB 1867 MHz LPDDR3 まずは現在のRubyのバージョンの確認 ターミナルで ruby -v と打ち込むと ruby 2.6.8 だと判明。 まずは下準備として 下記URLからHomebrewをインストール https://brew.sh/index_ja.html インストールの文字のしたのスクリプトをコピーしてターミナルにペーストする。 何度かパスワードを入力を求められるのでMacのパスワードを入力する。 環境にもよるだろうがダウンロード、インストールに筆者はかなり時間がかかった。 無事インストールが終わった後   下記コマンドを実行してrbenvとruby-build をインストールする。 brew install rbenv インストールが終わったら続いて下記コマンドを実行しrbenvの設定をする。 rbenv init 上を実行するとターミナルに # Load rbenv automatically by appending # the following to ~/.zshrc: eval "$(rbenv init - zsh)" と出てくるので ~/.zshrc を実行するも zsh: no such file or directory: となるので touch .zshrc を実行しファイルを作成 open ~/.zshrc でエディタを開き下記を書き込み保存 eval "$(rbenv init - zsh)" ターミナルを再起動するか source ~/.zshrc を実行し設定を反映させる。 rbenv を実行しバージョンが出ればOK いよいよRubyのインストールに入ります rbenv install -l でインストール可能なバージョンを確認 2.6.9 2.7.5 3.0.3 3.1.0 jruby-9.3.2.0 mruby-3.0.0 rbx-5.0 truffleruby-21.3.0 truffleruby+graalvm-21.3.0 今回は安定版の3.1.0をインストールしていきます rbenv install 3.1.0 ここもかなり時間がかかりました。 インストールが完了したら ターミナルを再起動し rbenv global 3.1.0 とすることで全てのシェルで3.1.0が使えます。 再度 ruby --version でバージョンを確認すると見事 ruby 3.1.0 と表示されインストールが完了した。
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

M1 MacでAWS CDK環境を整備する

このドキュメントは Mac上でCDK環境を整備する方法をまとめたものです 前提条件 使用PC 手順 homebrewでaws-cdkをインストールする % brew install aws-cdk ==> Downloading https://ghcr.io/v2/homebrew/core/node/manifests/17.4.0 Already downloaded: /Users/mukai/Library/Caches/Homebrew/downloads/794ea4ad96ad44757653ec3839632a88467cde669de3305f9d5f12ce1bd81769--node-17.4.0.bottle_manifest.json ==> Downloading https://ghcr.io/v2/homebrew/core/node/blobs/sha256:1954cb0ba19e7426054249eda70dff8bda197a960f4e0524af717245faa13529 Already downloaded: /Users/mukai/Library/Caches/Homebrew/downloads/66eb66783323a07fdee08e1e680a0c3cf4081301b4b5e2c706aaacadcbc01c5f--node--17.4.0.arm64_monterey.bottle.tar.gz ==> Downloading https://ghcr.io/v2/homebrew/core/aws-cdk/manifests/2.8.0 Already downloaded: /Users/mukai/Library/Caches/Homebrew/downloads/86f67ab001382e06f746a2028f74cd1b456fd42205fd9027bdc334462758c5cf--aws-cdk-2.8.0.bottle_manifest.json ==> Downloading https://ghcr.io/v2/homebrew/core/aws-cdk/blobs/sha256:d3b1acac013ab7e7d72dbca9e4c2e475d265eb0b7c4fcaeb1c19df92582bb98b Already downloaded: /Users/mukai/Library/Caches/Homebrew/downloads/2059e2a9adac14728af21d7f8d0328c3ddd5c329ec2d57c6a2db505e93197acf--aws-cdk--2.8.0.arm64_monterey.bottle.tar.gz ==> Installing dependencies for aws-cdk: node ==> Installing aws-cdk dependency: node ==> Pouring node--17.4.0.arm64_monterey.bottle.tar.gz ? /opt/homebrew/Cellar/node/17.4.0: 1,984 files, 44.5MB ==> Installing aws-cdk ==> Pouring aws-cdk--2.8.0.arm64_monterey.bottle.tar.gz ? /opt/homebrew/Cellar/aws-cdk/2.8.0: 9,755 files, 174.9MB ==> Running `brew cleanup aws-cdk`... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). バージョン確認 正常に動いてはいるが、依存関係でインストールされたnodeのバージョンが新しいのでCDKは動作未確認とのこと。 % cdk --version !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !! !! This software has not been tested with node v17.4.0. !! !! You may to encounter runtime issues, and should switch to a supported release. !! !! !! !! As of the current release, supported versions of node are: !! !! - ^12.7.0 !! !! - ^14.5.0 !! !! - ^16.3.0 !! !! !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2.8.0 (build 8a5eb49) nodeのダウングレード cdkのコマンドを叩くたびにいちいちコーションが出るのは嫌なのでnodeをダウングレードする。 Homebrewでインストールされたnodeをアンインストールし、nodebrewでnodeを改めてインストールする。 % brew uninstall node Error: Refusing to uninstall /opt/homebrew/Cellar/node/17.4.0 because it is required by aws-cdk, which is currently installed. You can override this and force removal with: brew uninstall --ignore-dependencies node aws-cdkと依存関係があるのでアンインストールできないらしい。 指示に従って、オプションをつけてリトライ % brew uninstall --ignore-dependencies node Uninstalling /opt/homebrew/Cellar/node/17.4.0... (1,984 files, 44.5MB) できた。続いて、nodebrewインストール。 % brew install nodebrew ==> Downloading https://ghcr.io/v2/homebrew/core/nodebrew/manifests/1.1.0-1 Already downloaded: /Users/mukai/Library/Caches/Homebrew/downloads/f5786fdcabaf7a91171f3d803ecbb7b8d5d0fd7bd5f9f13a0fda7b7722b46af8--nodebrew-1.1.0-1.bottle_manifest.json ==> Downloading https://ghcr.io/v2/homebrew/core/nodebrew/blobs/sha256:f9e68ad3b92827534fc9faf5d7b9c4d1fe61e4e1fa11a99e03c6cc476593fe09 Already downloaded: /Users/mukai/Library/Caches/Homebrew/downloads/e570150909b477bae65e749b152e5d87aa71158439019f8e2309456f25cf9993--nodebrew--1.1.0.all.bottle.1.tar.gz ==> Pouring nodebrew--1.1.0.all.bottle.1.tar.gz ==> Caveats You need to manually run setup_dirs to create directories required by nodebrew: /opt/homebrew/opt/nodebrew/bin/nodebrew setup_dirs Add path: export PATH=$HOME/.nodebrew/current/bin:$PATH To use Homebrew's directories rather than ~/.nodebrew add to your profile: export NODEBREW_ROOT=/opt/homebrew/var/nodebrew zsh completions have been installed to: /opt/homebrew/share/zsh/site-functions ==> Summary ? /opt/homebrew/Cellar/nodebrew/1.1.0: 8 files, 39KB ==> Running `brew cleanup nodebrew`... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`). パスを通せと書かれているので、~/.zshrcに以下を追記 # nodebrew export PATH=$HOME/.nodebrew/current/bin:$PATH 設定を反映する source ~/.zshrc 今回はcdkも検証が完了しているv16.3.0を使うことにする % nodebrew install-binary v16.3.0 Fetching: https://nodejs.org/dist/v16.3.0/node-v16.3.0-darwin-arm64.tar.gz ######################################################################################################################################################################################################################### 100.0% Installed successfully % nodebrew ls v16.3.0 current: none % nodebrew use v16.3.0 use v16.3.0 % node -v v16.3.0 もう一度、cdkのバージョン確認コマンドを打鍵し、コーションが出ないか確認する。 % cdk --version 2.8.0 (build 8a5eb49) 問題なしなのでこれで完了
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む