20211202のMacに関する記事は3件です。

nodebrewからnodenvに移行しようとしてハマりまくった環境構築メモ

概要 勉強したい本の環境構築が nodenv を利用していて、nodebrew を使っていたのですが揃えた方がきっと詰まらず進むだろうと思い環境切り替えを試みたら辛かった覚書です。 環境は相当長く使っている Mac で、Node を直接インストールしたのち、nodebrew に移行しています。 OS は現在は Catalina までアップデート済みです。 こちらを参考にさせていただいて切り替えていきます。 『nodebrew から nodenv に移行しました』 nodebrew アンインストール 現在のインストールバージョンをメモします。 % nodebrew list v9.1.0 早速、最初の brew update でエラーでました。 % brew update Error: /usr/local is not writable. You should change the ownership and permissions of /usr/local back to your user account: sudo chown -R $(whoami) /usr/local 言われた通りコマンド叩きます。 % sudo chown -R $(whoami) /usr/local chown: /usr/local: Operation not permitted できない。 Homebrew 再インストールするらしいです。 参考:https://qiita.com/art_aco/items/834ebdf4abfb3445fc0c /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 今度こそ % brew update error: Not a valid ref: refs/remotes/origin/master 今度は違うエラー・・・。 しばらく待つとダウンロードが始まるけれど、結果エラーで終了。 fatal: ambiguous argument 'refs/remotes/origin/master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' fatal: Needed a single revision ==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:0cb1cc7af109437fe0e020c9f3b7b95c3c709b140bde9f991ad2c1433496dd42 ##################################################################################################################################### 100.0% ==> Pouring portable-ruby-2.6.8.yosemite.bottle.tar.gz ==> Homebrew has enabled anonymous aggregate formula and cask analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics No analytics have been recorded yet (nor will be during this `brew` run). ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations Already up-to-date. Error: Could not link: /usr/local/etc/bash_completion.d/brew Please delete these paths and run: brew update Error: Could not link: /usr/local/share/zsh/site-functions/_brew Please delete these paths and run: brew update Error: Could not link: /usr/local/share/man/man1/brew.1 Please delete these paths and run: brew update Error: Could not link: /usr/local/share/doc/homebrew Please delete these paths and run: brew update 書いてある通りに指摘のパスを消して再実行してみます。 % rm -rf /usr/local/etc/bash_completion.d/brew % rm -rf /usr/local/share/zsh/site-functions/_brew % rm -rf /usr/local/share/man/man1/brew.1 % rm -rf /usr/local/share/doc/homebrew % brew update fatal: Needed a single revision Already up-to-date. とりあえずできた? やっと、nodebrewをアンインストールします。 % brew uninstall nodebrew Warning: Unexpected method 'license' called on Cask alfred. Follow the instructions here: https://github.com/Homebrew/homebrew-cask#reporting-bugs Warning: Unexpected method 'accessibility_access' called on Cask alfred. Follow the instructions here: https://github.com/Homebrew/homebrew-cask#reporting-bugs Warning: Unexpected method 'license' called on Cask clipy. Follow the instructions here: https://github.com/Homebrew/homebrew-cask#reporting-bugs Error: Cask 'clipy' definition is invalid: invalid 'depends_on macos' value: unknown or unsupported macOS version: :mavericks はい、またエラー。mavericksとか懐かしい。 依存部分を削除します。 % /usr/bin/find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | /usr/bin/xargs -0 /usr/bin/perl -i -0pe 's/depends_on macos: \[.*?\]//gsm;s/depends_on macos: .*//g' 再挑戦。 % brew uninstall nodebrew いろいろWarning Uninstalling /usr/local/Cellar/nodebrew/0.9.6... (7 files, 36.8KB) やっとアンインストールできた・・・。 まだ最初の参考サイトのコマンド3つ目までしか進んでない。 これもしておきます。 利用しているシェルの設定ファイルから以下を削除する。 export PATH=$HOME/.nodebrew/current/bin:$PATH nodenv インストール やっとnodenvインストール! 本ではanyenv経由でnodenvを入れているので、ここからは本の方に倣います。 ちなみに本ですと、これだけ実行すれば終わりだよ簡単!という感じでした。 $ brew install anyenv $ echo 'eval "$(anyenv init -)"' >> ~/.zshrc $ exec $SHELL -l $ anyenv install nodenv $ exec $SHELL -l やってみます。 % brew install anyenv fatal: Needed a single revision Warning: No available formula with the name "anyenv". ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching taps on GitHub... Error: No formulae found in taps. 簡単じゃない。 う、うーん。先生助けてください。 % brew doctor Warning: Unexpected method 'license' called on Cask karabiner. Follow the instructions here: https://github.com/Homebrew/homebrew-cask#reporting-bugs Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks! Warning: Homebrew/homebrew-core was not tapped properly! Run: rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" brew tap homebrew/core Warning: Some installed kegs have no formulae! This means they were either deleted or installed with `brew diy`. You should find replacements for the following formulae: pkg-config libtiff libtool czmq libpng pixman gdbm freetype python pango icu4c zeromq harfbuzz glib readline cairo sqlite gobject-introspection fontconfig gettext libsodium pcre ricty jpeg zsh fontforge openssl git libffi Warning: You have unlinked kegs in your Cellar. Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on those kegs to fail to run properly once built. Run `brew link` on these: pkg-config libtiff libtool czmq libpng pixman gdbm freetype python pango icu4c zeromq harfbuzz glib readline cairo sqlite gobject-introspection fontconfig gettext libsodium pcre ricty jpeg zsh fontforge openssl git libffi Error: No available formula with the name "git". すごいでた。過去のいろいろが荒ぶっています。 1つ目からコマンド叩いていきます・・・。 % rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" % brew tap homebrew/core 時間かかりますが完了。 再度先生にお願い。 % brew doctor Warning: Some installed kegs have no formulae! This means they were either deleted or installed with `brew diy`. You should find replacements for the following formulae: ricty Warning: You have unlinked kegs in your Cellar. Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on those kegs to fail to run properly once built. Run `brew link` on these: pkg-config libtiff libtool czmq libpng pixman gdbm freetype python pango zeromq harfbuzz glib cairo gobject-introspection fontconfig gettext libsodium pcre ricty jpeg zsh fontforge git Warning: An outdated version (2.9.2) of Git was detected in your PATH. Git 2.14.3 or newer is required for Homebrew. Please upgrade: brew upgrade git Warning: Broken symlinks were found. Remove them with `brew cleanup`: /usr/local/bin/subl Warning: Some installed formulae are missing dependencies. You should `brew install` the missing dependencies: brew install ca-certificates fribidi giflib graphite2 libpthread-stubs libspiro libuninameslist libx11 libxau libxcb libxdmcp libxext libxrender lzo m4 mpdecimal ncurses openssl@1.1 pcre2 xorgproto xz Run `brew missing` for more details. 2つ目だったエラー解消へ。さよなら ricty % brew uninstall ricty 3つ目のリンクエラー解消へ。多い・・・。 % brew link pkg-config libtiff libtool 省略 4つ目。Git古すぎ問題。 % brew upgrade git % git --version git version 2.34.1 5つ目。お掃除。 % brew cleanup 6つ目。もういらないものも居そうですが。 % brew install ca-certificates fribidi giflib graphite2 libpthread-stubs libspiro libuninameslist libx11 libxau libxcb libxdmcp libxext libxrender lzo m4 mpdecimal ncurses openssl@1.1 pcre2 xorgproto xz さて、これで先生も落ち着いてくれるかなと思ったら、 % brew doctor zsh: killed brew doctor PC 再起動します。 % brew doctor Your system is ready to brew. やっときれいになりました! インストールに戻ります。 % brew install anyenv 無事に完了。 2行目のコマンドの eval "$(anyenv init -)" は zsh 用ファイルを分けているので別ファイルに書きましたが、がエラー出ました。 ANYENV_DEFINITION_ROOT(/Users/*****/.config/anyenv/anyenv-install) doesn't exist. You can initialize it by: > anyenv install --init 言われた通りにコマンドを実行します。 % anyenv install --init Manifest directory doesn't exist: /Users/*****/.config/anyenv/anyenv-install Do you want to checkout https://github.com/anyenv/anyenv-install.git? [y/N]: y Completed! もう一度実行したら eval "$(anyenv init -)" のエラーは解消しました。 % anyenv install nodenv % exec $SHELL -l % nodenv install -l 0.1.14 0.1.15 0.1.16 やっと動きました・・・!!! まとめ 本命の言語学習に入る前に力尽きそうでしたがなんとか終わりました。 環境構築はまっさらな状態からでないとハマりどころが多く・・・結局ほぼ全部のコマンドでエラーになったような気がします。
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

Macにおけるファイルエンコーディングの確認方法

はじめに プロを目指す人にためのRuby入門に取り組んでいたところ、ファイルエンコーディングを確認する機会があったため、忘れないようにメモとして残しておこうと思います。 ファイルエンコーディングの確認方法 ファイルエンコーディングを確認する際はfileコマンドを使用します。--mime-encodingをオプションとして加えることによって、ファイルエンコーディングのみ出力されます。 コンソール file --mime-encoding sample.rb sample.rb: utf-8 出力結果から、ファイルエンコーディングはUTF-8だとわかりました。 UTF-8 (文字コードとファイルエンコーディングの違いで混乱した時に読んだ記事です)
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

ウェブサイト開発に便利なmacアプリケーションの紹介

株式会社じげんのkkosukeです。 UI作成などのフロントエンドを担当しています。 ウェブサイトを開発する上で、効率的な開発環境をつくるのは欠かせないですよね! 今回は、そんな開発環境に欠かせない便利なmacのアプリケーションをまとめてみました。 無料のものもあるので、気になるものは気軽にダウンロードをしてみてください。 エディター系 Visual Studio Code 通称VSCodeとして広く使われているエディターです。Microsoft社が開発したテキストエディタです。 補助機能が強力なのが特徴です。 sublime text シンプル、軽量、サクサク、検索や置換がしやすい!そんなエディターが好きなかたは、このsublime textをオススメします! MacDown メモを取る時など、文章を考える時など文章を書きたい時に重宝するのがMarkdown。 Markdownエディターにも有料、無料のもの数多くありますが、このエディターを使っている方が多かったです。 データベース系 DBeaver DBeaverは、SQLクライアントアプリです。MySQLだけではなく、PostgreSQLをはじめ、ほとんどのDBに繋げられることができるし、機能も豊富! Sequel Pro、Sequel Ace Mac用のMySQLのデータをGUI操作で管理するためのアプリケーションです。無料で使えるので、多くの人が使っていました。 Sequel AceというSequel Proの後継アプリもおすすめです。 Cyberduck Cyberduckは、FTPクライアントアプリです。黄色いアヒルのアイコンがかわいいのも特徴の1つです。 CloudMounter クラウドサービス上に保存しているファイルにFinder経由で直接アクセスできるようになるアプリです。 ローカルにファイルを保持しないのもメリットの1つです。 ターミナル系 iterm2 iterm2はコマンドラインアプリです。macにもターミナルというコマンドラインツールがありますが、このiterm2は、画面分割ができるなど多機能なため、使われているようです。 Source tree Source treeは、Gitを視覚的に操作できるアプリです。コマンドラインツールをしようしなくても操作ができるのが特徴です。 ショートカット系 Alfred Macに標準でついているSpotlightのようなランチャーアプリです。見た目がかっこいい、計算も検索もしやすいため、インストールしている人が多いようでした。 hammerspoon ショートカットキーのカスタマイズを行えるアプリです。 Command+Qや、任意のキーを長押しするといった操作のときに、特定の挙動を行うといった設定が可能です。 BetterTouchTool ラックパッドやらマジックマウスのジェスチャーと機能を変えられるアプリです。 ChromeやSafariなどのアプリケーションごとに設定ができるため、自分好みにmacを操作したい方にはオススメのアプリです。 TotalSpaces2 Macのミッションコントロールをさらに使いやすくしてくれるアプリです。 macのデスクトップを縦横に並べることができるので、複数の環境の切り替えが楽にできます。 Magnet Macの画面を分割したり、並べて表示を行うことができるアプリです。 Spectacle こちらもMacの画面を分割したり、並べて表示を行うことができるアプリです。 HyperSwitch Mac で Windows のようなウィンドウ単位の切り替えを実現してくれるアプリです。 Chromeやfinderを複数のウィンドウで立ち上げていた場合でも、切り替えがしやすくなるので、オススメです! HyperDock こちらはmacのdockアプリをサムネイルプレビューしてくれるアプリです。 ウィンドウをドラッグで、特定のサイズに拡大、リサイズされる機能もあります。 MonthlyCal タッチパッドをスワイプすると出てくる通知センターにカレンダーを表示してくれるアプリです。 スケジュールの確認に一役買っています。 Dozer Macのメニューバーに表示されているアイコンを一時的に隠すことができるアプリです。 macのメニューバーをすこしでもスッキリさせたい方にオススメです。 Yoink ドラッグ&ドロップの操作を快適にしてくれるアプリです。finderをウィンドウが重ならないように並べるとった地味な作業もなくせるので、必須といってもいいくらいのアプリです。 CopyClip CopyClipはクリップボード管理アプリです。 Clipy こちらも、クリップボード管理アプリです。 画像系 jpegmini JPEG画像を画質を落とさずに圧縮してくれるアプリです。 Crunch PNG画像を画質を落とさずに圧縮してくれるアプリです。 Chrome拡張機能系 FireShot ウェブページ全体をスクリーンショットしたり、指定部分を画像として保存するときに使っています。 シンプルで使いやすいので、まだ入れていない方は是非! Vimium vimキーバインドでGoogle Chromeを使えるようにできるプラグインです。キーボードから手を離したくない!そんな方は、1度使ってみてはいかがでしょうか? EditThisCookie サイトのCookieを管理できる拡張機能です。Cookieを追加、削除、などをかんたんに行うことができます。 お菓子の「クッキー」のアイコンもわかりやすくてかわいい! その他 1password パスワードの一元管理ができるアプリです。 nearlock Macの画面ロックをiPhoneの距離で自動解除してくれるアプリです。 Libre Office Mac向けのマイクロソフト・オフィス(以降MSオフィス)互換の無料ソフトです。 duet iPadをmacのサブディスプレイにすることができるアプリです。 まとめ いろんなアプリで、ウェブサイトの開発環境を整えていきましょう!
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む