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

Mac設定メモ

はじめに ・一般的な設定は他人の記事を参考にする ・上記以外で特に重要だと思うことを書く ・これはMac初心者の私の備忘録 ・よい方法があれば教えてください 一般的な設定 この記事を参考にした Mac を買ったら必ずやっておきたい初期設定 隠しフォルダ表示 # 隠しフォルダを表示するコマンド defaults write com.apple.finder AppleShowAllFiles TRUE # Finderを再起動 killall Finder システム設定 CapsLockをOFF システム環境設定 > キーボード > 装飾 CapsLock: アクションなし Karabinerでバインドを変更する ここでキーバインドを参考にしたりする https://ke-complex-modifications.pqrs.org/ ここで項目の設定方法を参考にする バインドを適用する対象のデバイス KarabinerのDeviceからデバイスを選択できる マウスとキーボードのTypeが一致していることを確認する デバイスがマウスなのに、TypeがキーボードだとButtonのバインドができないので注意 ソースの切り替え karabinerでcapslockをcontrolに割り当てる 小指と親指で切り替えが楽 control + space  キーボード、マウスのキーコードを取得 Karabiner EventViewerで任意のキーやボタンのコードを取得できる 愛用のキーボードバインディング キーボード: Mistel BAROCCO MD770 裏のスイッチがすべてOFFの状態でバインドを設定する Windowsもつかうのでいじると面倒になるので 設定例 left_option -> left_command left_command -> left_option right_option -> right_command caps_lock -> left_control optionとcommandを入れ替え、CapsLockをControlにする { "title": "MD770 keybord bind for Mac", "rules": [ { "description": "cmd<->option caplock->control", "manipulators": [ { "type": "basic", "from": { "key_code": "left_command" }, "to": [ { "key_code": "left_option" } ] }, { "type": "basic", "from": { "key_code": "left_option" }, "to": [ { "key_code": "left_command" } ] }, { "type": "basic", "from": { "key_code": "caps_lock" }, "to": [ { "key_code": "left_control" } ] } ] } ] } バインドの有効範囲 任意のアプリ アプリをアクティブにしてからKarabiner Eventviewer の FrontMost applicationタブからアプリのidをみれる Finder内のみ有効にするとき "conditions": [ { "bundle_identifiers": ["^com\\.apple\\.finder$"], "type": "frontmost_application_if" } ] control + hjkl でカーソル移動するバインド { "title": "Left ctrl + hjkl to Arrow Keys Vim", "rules": [ { "description": "Left ctrl + hjkl toarrow keys Vim", "manipulators": [ { "from": { "key_code": "h", "modifiers": { "mandatory": ["left_control"], "optional": ["any"] } }, "to": [ { "key_code": "left_arrow" } ], "type": "basic" }, { "from": { "key_code": "j", "modifiers": { "mandatory": ["left_control"], "optional": ["any"] } }, "to": [ { "key_code": "down_arrow" } ], "type": "basic" }, { "from": { "key_code": "k", "modifiers": { "mandatory": ["left_control"], "optional": ["any"] } }, "to": [ { "key_code": "up_arrow" } ], "type": "basic" }, { "from": { "key_code": "l", "modifiers": { "mandatory": ["left_control"], "optional": ["any"] } }, "to": [ { "key_code": "right_arrow" } ], "type": "basic" } ] } ] } 例外アプリを指定 バインドを適用したくないアプリを指定する frontmost_application_unlessをconditionsのtypeに記述する "conditions": [ { "type": "frontmost_application_unless", "bundle_identifiers": [ "^com\\.googlecode\\.iterm2" ] } ] iTerm2 ターミナルをインストール 起動ショートカットを設定 Preferences > keys > Hotkye > create hot key double tap > control Preferences > General > Window restration policy ウィンドウの起動の仕方 Only Restore Hotkey Window 起動ショートカットするたびにウィンドウが生成されない設定 ウィンドウの透明度 Preferences > Profiles > Window > Windows Apprearance Trancparancy : 3~4割 TextMete 軽量エディタをインストールする VSCode Vimの長押し移動ができない問題の対処 defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false # For VS Code defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false # For VS Code Insider ワークペースのPythonバージョンを固定 ワークスペース名/.vscode/settings.json { "python.pythonPath": "/opt/homebrew/bin/python3" } M1でWine ビルド済みのWineをgitクローンして、 https://github.com/Gcenx/homebrew-wine wintrickから日本語を入れる brew install wget wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks chmod +x winetricks ./winetricks fonts fakejapanese Wineアプリショートカット作成 Automator > 新規 > アプリケーション > 左のサイドバー > シェルスクリプトを実行 実行するシェルの種類を選んで、シェルを記述する ファイル > 保存 システム環境設定 > プライバシーとセキュリティー > アクセシビリティ 作成したアプリを追加する Finder > 作成したアプリ > 右クリック > 情報 アイコンに任意の画像をドロップ&ドラッグしてアイコンを変更する
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

Windows ←→ Mac 快適にするキーバインド設定自分メモ

はじめに ・必要最低限の設定を目指す ・これはMac初心者の私の備忘録 ・よい方法があれば教えてください ・下記すべて無意味だった Karabinerを入れたら、システム設定のみでiTremが快適に使えるようになった システム システム環境設定 > キーボード > 装飾 CapLock : Command Control : アクションなし Option : Option Command : Control 地球儀 : アクションなし ソース切り替え 前提 CapsLockがCommandになっている 操作 小指と親指をつかって替えを行う 設定 キーボード>ショートカット > 入力ソース 前の入力ソースを選択 : Command+Space iTrem この状態だとiTremが快適につかえないので、キーバインドを設定する Remap Preferences > Keys > Remap Modiffiers Command : Control Control : Cmmand アプリの切り替えができるようにする Preferences > Keys > Key Bindings ターミナルないのタブ移動をするバインドをすべて削除または変更する Do Not Remap Modiffiers : Control + Tab
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む

C++ opencv 環境構築 (Mac)

はじめに Macで, C++のOpenCV環境の構築方法について簡単にメモしました. 手順 インストール homebrewでopencvをインストール. $ brew install opencv 以下のコマンドでバージョンを確認可能. $ brew list --versions | grep opencv opencv 4.5.2 VSCodeの設定 VSCodeではIntelliSenseを使うためにc_cpp_properties.jsonのincludePathにOpenCVのパスを設定. Command+Shift+P でコマンドパレットを開き,「C/Cpp: Edit configurations」 を選択. 今回は以下のように設定. { "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/**", "/usr/local/include/opencv4" ], "defines": [], "macFrameworkPath": [], "compilerPath": "/usr/local/bin/g++", "cStandard": "gnu17", "cppStandard": "gnu++14", "intelliSenseMode": "macos-gcc-x64" } ], "version": 4 } 実行テスト CMakeLists.txtとサンプルコードtest1.cppを作成.ファイル階層は以下のようになっています. . ├── CMakeLists.txt ├── sample.jpeg └── test1.cpp CMakeLists.txtに今回は以下を記述. cmake_minimum_required(VERSION 3.1) project (test1) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") find_package(OpenCV REQUIRED) include_directories( ${OpenCV_INCLUDE_DIRS} ) add_executable(Main test1.cpp) target_link_libraries(Main ${OpenCV_LIBS}) test1.cppには以下を記述. #include <iostream> #include <opencv2/opencv.hpp> int main() { cv::Mat img = cv::imread("sample.jpeg"); cv::namedWindow("test", cv::WINDOW_AUTOSIZE); cv::imshow("test", img); cv::waitKey(0); cv::destroyWindow("test"); return 0; } コンパイルのため,以下のコマンドをterminalで実行して,画像が表示されればokです. mkdir build cd build cmake .. . make cd .. ./build/Main コマンドについて 自分のソースコードとcmakeのbuildにより生成されるファイルを分離するために,buildディレクトリを作ってから"cmake .. ."によりCMakeLists.txtを実行. "make"によりコンパイルして./Mainを生成. 画像ファイルとソースコードと同じ階層で実行する必要があるので, "cd .."で上の階層に移ってから,"./build/Main"を実行. 以下が,今回自分が作成したものとなっています. 作成したプロジェクト 参考 MacにOpenCV4をインストールする(C++) MacにOpenCV(C++)環境を構築する
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む