{"id":1736,"date":"2024-04-20T07:59:46","date_gmt":"2024-04-20T07:59:46","guid":{"rendered":"https:\/\/howtogeek.blog\/ja\/?p=1736"},"modified":"2024-04-20T07:59:46","modified_gmt":"2024-04-20T07:59:46","slug":"how-to-run-a-shell-script-on-mac-ja","status":"publish","type":"post","link":"https:\/\/howtogeek.blog\/ja\/how-to-run-a-shell-script-on-mac-ja\/","title":{"rendered":"Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>Mac \u306b\u30a2\u30d7\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u306f\u6bd4\u8f03\u7684\u7c21\u5358\u3067\u3001\u518d\u8d77\u52d5\u304c\u5fc5\u8981\u306b\u306a\u308b\u3053\u3068\u306f\u307b\u3068\u3093\u3069\u3042\u308a\u307e\u305b\u3093\u3002\u307b\u3068\u3093\u3069\u306e\u4eba\u306f\u30a2\u30d7\u30ea\u306e\u30a2\u30a4\u30b3\u30f3\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30c9\u30e9\u30c3\u30b0 \u30a2\u30f3\u30c9 \u30c9\u30ed\u30c3\u30d7\u3057\u307e\u3059\u304c\u3001\u30de\u30cb\u30a2\u306f\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u3044\u304f\u3064\u304b\u306e\u70b9\u306b\u7559\u610f\u3059\u308c\u3070\u3001Mac \u306e<a href=\"https:\/\/support.apple.com\/en-in\/guide\/terminal\/apd53500956-7c5b-496b-a362-2845f2aab4bc\/mac\" rel=\"noreferrer noopener\" target=\"_blank\">\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092<\/a>\u7c21\u5358\u306b\u5b9f\u884c\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u307e\u305a\u3001\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u3001\u4f55\u304c\u3067\u304d\u308b\u306e\u304b\u3092\u77e5\u3089\u305a\u306b\u5b9f\u884c\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u7c21\u5358\u306a\u65b9\u6cd5\u3068\u5b89\u5168\u306a\u65b9\u6cd5\u306e 2 \u3064\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2><span id=\"Things-You-Need-to-Know-About-Shell-Scripts\">\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3064\u3044\u3066\u77e5\u3063\u3066\u304a\u304f\u3079\u304d\u3053\u3068<\/span><\/h2>\n<p>\u30b7\u30a7\u30eb\u306f\u3001\u30b3\u30de\u30f3\u30c9\u3067\u4f7f\u7528\u3067\u304d\u308b\u5bfe\u8a71\u578b\u306e\u30c6\u30ad\u30b9\u30c8\u30d9\u30fc\u30b9\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3067\u3059\u3002\u3064\u307e\u308a\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3001\u7e70\u308a\u8fd4\u3057\u306e\u30bf\u30b9\u30af\u3067\u30b3\u30de\u30f3\u30c9\u3092\u518d\u5165\u529b\u3059\u308b\u624b\u9593\u3092\u7701\u304f\u305f\u3081\u306b\u3001\u8907\u6570\u306e\u30b3\u30de\u30f3\u30c9\u3092\u542b\u3080\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3059\u3002\u3053\u306e\u3088\u3046\u306b\u3057\u3066\u3001\u8907\u6570\u306e\u30bf\u30b9\u30af\u3092 1 \u3064\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u307e\u3068\u3081\u3001\u6642\u9593\u3092\u7bc0\u7d04\u3057\u3001\u7e70\u308a\u8fd4\u3057\u306e\u30bf\u30b9\u30af\u3067\u767a\u751f\u3059\u308b\u30a8\u30e9\u30fc\u3092\u56de\u907f\u3067\u304d\u307e\u3059\u3002\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u306f\u3001SH \u62e1\u5f35\u5b50\u304c\u4ed8\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u57fa\u672c\u306b\u3064\u3044\u3066\u306f\u3053\u308c\u4ee5\u4e0a\u8aac\u660e\u3057\u307e\u305b\u3093\u3002Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u3073\u305f\u3044\u5834\u5408\u306f\u3001Apple \u306e<a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/OpenSource\/Conceptual\/ShellScripting\/shell_scripts\/shell_scripts.html\" rel=\"noreferrer noopener\" target=\"_blank\">\u516c\u5f0f Shell Scripting Primer<\/a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3068\u306f\u3044\u3048\u3001\u982d\u3092\u60a9\u307e\u305b\u305f\u308a\u5fc3\u914d\u3057\u305f\u308a\u3057\u306a\u3044\u305f\u3081\u306b\u306f\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u95a2\u3059\u308b 2 \u3064\u306e\u898f\u5247\u3092\u899a\u3048\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p><strong>1.<\/strong> <strong>\u6a29\u9650\u3092\u76f2\u76ee\u7684\u306b\u4ed8\u4e0e\u3059\u308b\u3068\u9006\u52b9\u679c\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059<\/strong>\u2013 \u901a\u5e38\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u306e\u306b\u30eb\u30fc\u30c8 \u30e6\u30fc\u30b6\u30fc (\u7ba1\u7406\u8005\u30ec\u30d9\u30eb\u306e\u6a29\u9650) \u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002\u305f\u3060\u3057\u3001\u9078\u629e\u3057\u305f\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b sudo \u30e6\u30fc\u30b6\u30fc (\u7ba1\u7406\u8005) \u6a29\u9650\u304c\u5fc5\u8981\u306a\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u5b8c\u5168\u306a\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u524d\u306b\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5185\u5bb9\u3068\u30bd\u30fc\u30b9\u3092\u518d\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3092\u5f37\u304f\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n<p>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u3068\u3057\u3066\u3001macOS \u3067\u306f\u3001\u30b7\u30b9\u30c6\u30e0 \u30d5\u30a9\u30eb\u30c0\u30fc\u304b\u3089\u30eb\u30fc\u30c8\u6a29\u9650\u3092\u5fc5\u8981\u3068\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u6a29\u9650\u304c\u4ed8\u4e0e\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p><strong>2.<\/strong> <strong>\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b<\/strong>\u2013 Sublime Text \u306a\u3069\u306e\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3001\u4ed6\u306e\u5834\u6240\u304b\u3089\u53d6\u5f97\u3057\u305f\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8868\u793a\u3057\u305f\u308a\u3001\u65b0\u3057\u3044\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u305f\u308a\u3067\u304d\u307e\u3059\u3002\u5185\u5bb9\u304c\u308f\u304b\u308b\u304b\u3069\u3046\u304b\u306b\u95a2\u4fc2\u306a\u304f\u3001\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u306f\u3001\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u7c21\u5358\u306b\u691c\u8a3c\u3067\u304d\u308b\u30b3\u30de\u30f3\u30c9\u3092\u8868\u793a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.sublimetext.com\/download_thanks?target=mac\" rel=\"noreferrer noopener\" target=\"_blank\"><strong>Mac\u7528Sublime Editor\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/strong><\/a><\/p>\n<h2><span id=\"Try-This-Test-Script\">\u3053\u306e\u30c6\u30b9\u30c8\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8a66\u3059<\/span><\/h2>\n<p>\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f\u3001\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066 Sublime Text \u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p> <code> <code>#! \/bin\/bash<br \/>\necho \"Hello World!\"<\/code><\/code><\/p>\n<figure class=\"wp-block-image\"><img alt=\"Sublime Text \u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002\" class=\"wp-image\" decoding=\"async\" height=\"723\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Test-Shell-Script-1024x723-1.webp\" title=\"Sublime Text \u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002\" width=\"1024\"\/><\/figure>\n<p>\u305d\u306e\u5f8c\u3001\u30c6\u30b9\u30c8\u76ee\u7684\u3067\u30d5\u30a1\u30a4\u30eb\u3092 test.sh \u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2><span id=\"Easy-Way-to-Run-the-Shell-Script-on-Mac\">Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u7c21\u5358\u306a\u65b9\u6cd5<\/span><\/h2>\n<p>\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u6700\u3082\u7c21\u5358\u306a\u65b9\u6cd5\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u958b\u3044\u3066\u5b9f\u884c\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u304c\u4f55\u3092\u5b9f\u884c\u3059\u308b\u304b\u3001\u304a\u3088\u3073\u305d\u306e\u8d77\u6e90\u3092\u8a8d\u8b58\u3057\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u5371\u967a\u306a\u884c\u70ba\u3067\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\u306b\u306f\u3001\u30eb\u30fc\u30c8 \u30e6\u30fc\u30b6\u30fc\u6a29\u9650\u3092\u5fc5\u8981\u3068\u3059\u308b\u30b3\u30de\u30f3\u30c9\u304c\u306a\u3044\u305f\u3081\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30c6\u30b9\u30c8 \u30b9\u30af\u30ea\u30d7\u30c8\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><strong>1. Spotlight \u691c\u7d22\u307e\u305f\u306f Mac \u306e Finder \u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u7528\u3057\u3066\u3001<\/strong><strong>\u30bf\u30fc\u30df\u30ca\u30eb \u30a2\u30d7\u30ea<\/strong>\u3092\u958b\u304d\u307e\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb \u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u304c\u3042\u308b\u30d5\u30a9\u30eb\u30c0\u306b\u5207\u308a\u66ff\u3048\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image\"><img alt=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u542b\u3080\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5909\u66f4\u3059\u308b\" class=\"wp-image\" decoding=\"async\" height=\"606\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Change-Directory-to-Shell-Script-Location-1024x606-1.webp\" title=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u542b\u3080\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u5909\u66f4\u3059\u308b\" width=\"1024\"\/><\/figure>\n<p><strong>2.<\/strong>\u30bf\u30fc\u30df\u30ca\u30eb\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u3001<strong>Return<\/strong>\u30ad\u30fc\u3092\u62bc\u3057\u307e\u3059\u3002<\/p>\n<p> <code> <code>sh &lt;shell script file name&gt;<\/code><\/code><\/p>\n<figure class=\"wp-block-image\"><img alt=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30c6\u30b9\u30c8\u3059\u308b\" class=\"wp-image\" decoding=\"async\" height=\"605\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Shell-Script-file-Run-1024x605-1.webp\" title=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30c6\u30b9\u30c8\u3059\u308b\" width=\"1024\"\/><\/figure>\n<p>\u307e\u305f\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb \u30a6\u30a3\u30f3\u30c9\u30a6\u306b sh \u3068\u5165\u529b\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u6b21\u306b\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092 Finder \u30a6\u30a3\u30f3\u30c9\u30a6\u304b\u3089\u958b\u3044\u3066\u3044\u308b\u30bf\u30fc\u30df\u30ca\u30eb \u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u30c9\u30e9\u30c3\u30b0 \u30a2\u30f3\u30c9 \u30c9\u30ed\u30c3\u30d7\u3057\u3001Return \u30ad\u30fc\u3092\u62bc\u3057\u307e\u3059\u3002<\/p>\n<p><strong>3.<\/strong>\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u51fa\u529b\u304c\u30bf\u30fc\u30df\u30ca\u30eb \u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u305f\u3068\u3048\u3070\u3001test.sh \u30d5\u30a1\u30a4\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30a6\u30a3\u30f3\u30c9\u30a6\u306b Hello World! \u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image\"><img alt=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u6210\u529f\" class=\"wp-image\" decoding=\"async\" height=\"606\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Shell-Script-Run-Success-1024x606-1.webp\" title=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u6210\u529f\" width=\"1024\"\/><\/figure>\n<p>\u30d5\u30a1\u30a4\u30eb\u304c\u5b9f\u884c\u3055\u308c\u306a\u3044\u5834\u5408\u306f\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u9069\u5207\u306a\u5b9f\u884c\u6a29\u9650\u3092\u4e0e\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p> <code> <code>sudo chmod +x &lt;shell script file location&gt;<\/code><\/code><\/p>\n<figure class=\"wp-block-image\"><img alt=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u5fc5\u8981\u306a\u6a29\u9650\u3092\u4e0e\u3048\u308b\" class=\"wp-image\" decoding=\"async\" height=\"606\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Shell-Script-Permissions-in-macOS-1024x606-1.webp\" title=\"Mac\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u5fc5\u8981\u306a\u6a29\u9650\u3092\u4e0e\u3048\u308b\" width=\"1024\"\/><\/figure>\n<p>Return \u30ad\u30fc\u3092\u62bc\u3057\u305f\u5f8c\u3001\u7ba1\u7406\u8005\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h2><span id=\"Safe-Way-to-Run-a-Shell-Script-on-Mac\">Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b89\u5168\u306b\u5b9f\u884c\u3059\u308b\u65b9\u6cd5<\/span><\/h2>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c\u53ef\u80fd\u6027\u3092\u78ba\u8a8d\u3059\u308b\u306b\u306f\u3001Sublime Text \u306a\u3069\u306e\u30b3\u30fc\u30c9\u7528\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30c6\u30b9\u30c8\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3067\u5b9f\u884c\u3057\u3066\u3082\u30b7\u30b9\u30c6\u30e0\u306b\u5909\u66f4\u306f\u52a0\u3048\u3089\u308c\u306a\u3044\u305f\u3081\u5b89\u5168\u3067\u3059\u3002<\/p>\n<p><strong>1.<\/strong> Mac \u3067 Sublime Text \u307e\u305f\u306f\u305d\u306e\u4ed6\u306e\u30b3\u30fc\u30c9\u7528\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002\u305d\u306e\u4e2d\u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8 (\u3053\u306e\u30ac\u30a4\u30c9\u3067\u306f test.sh) \u3092\u958b\u304d\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image\"><img alt=\"Mac \u306e Sublime Text Editor \u306e\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8 \u30d5\u30a1\u30a4\u30eb\" class=\"wp-image\" decoding=\"async\" height=\"780\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Shell-Script-in-Sublime-text-1024x780-1.webp\" title=\"Mac \u306e Sublime Text Editor \u306e\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8 \u30d5\u30a1\u30a4\u30eb\" width=\"1024\"\/><\/figure>\n<p><strong>3.<\/strong> <span data-preserver-spaces=\"true\">\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u4f7f\u7528\u3057\u3066\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u5b9f\u884c\u6a29\u9650\u3092\u4e0e\u3048\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<figure class=\"wp-block-image\"><img alt=\"\" class=\"wp-image\" decoding=\"async\" height=\"606\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Shell-Script-Permissions-in-macOS-1-1024x606-1.webp\" title=\"\" width=\"1024\"\/><\/figure>\n<p><strong>4.<\/strong> Sublime Text \u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u623b\u308a\u3001\u4e0a\u90e8\u306e\u30e1\u30cb\u30e5\u30fc\u30d0\u30fc\u306e\u300c\u30c4\u30fc\u30eb\u300d\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8 \u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300c\u30d3\u30eb\u30c9\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/p>\n<figure class=\"wp-block-image\"><img alt=\"\" class=\"wp-image\" decoding=\"async\" height=\"816\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Build-in-Sublime-text-1024x816-1.webp\" title=\"\" width=\"1024\"\/><\/figure>\n<p><strong>5. <\/strong> <span data-preserver-spaces=\"true\">Sublime Text \u5185\u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u5b8c\u4e86\u3057\u305f\u3053\u3068\u3092\u793a\u3059\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/span><\/p>\n<figure class=\"wp-block-image\"><img alt=\"\" class=\"wp-image\" decoding=\"async\" height=\"780\" loading=\"lazy\" src=\"https:\/\/cdn.howtogeek.blog\/wp-content\/uploads\/2024\/04\/Shell-Script-Sublime-Text-Run-1024x780-1.webp\" title=\"\" width=\"1024\"\/><\/figure>\n<p>\u6a29\u9650\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f\u3001\u624b\u9806 3 \u3092\u518d\u5ea6\u5b9f\u884c\u3057\u3066\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u9069\u5207\u306a\u6a29\u9650\u3092\u5272\u308a\u5f53\u3066\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2><span id=\"Enjoy-Shell-Scripts-With-a-Little-Caution\">\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5c11\u3057\u6ce8\u610f\u3057\u306a\u304c\u3089\u697d\u3057\u3080<\/span><\/h2>\n<p>\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3084\u305d\u306e\u4ed6\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0 \u30bf\u30b9\u30af\u7528\u306e\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u307b\u3068\u3093\u3069\u306f\u3001\u4f5c\u6210\u8005\u306b\u3088\u3063\u3066\u30c6\u30b9\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u305d\u306e\u5f71\u97ff\u3068\u4fe1\u983c\u6027\u304c\u308f\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001Mac \u306e\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u6a5f\u80fd\u3092\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306f\u3001Mac \u3092\u5371\u967a\u306b\u3055\u3089\u3059\u3088\u308a\u3082\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30c6\u30b9\u30c8\u3059\u308b\u3088\u308a\u5b89\u5168\u306a\u65b9\u6cd5\u3067\u3059\u3002\u305d\u308c\u4ee5\u5916\u306e\u5834\u5408\u306f\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u306f Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30c6\u30b9\u30c8\u3057\u3066\u5b9f\u884c\u3059\u308b\u306e\u306b\u6700\u9069\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mac \u306b\u30a2\u30d7\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306e\u306f\u6bd4\u8f03\u7684\u7c21\u5358\u3067\u3001\u518d\u8d77\u52d5\u304c\u5fc5\u8981\u306b\u306a\u308b\u3053\u3068\u306f\u307b\u3068\u3093\u3069\u3042\u308a\u307e\u305b\u3093\u3002\u307b\u3068\u3093\u3069\u306e\u4eba\u306f\u30a2\u30d7\u30ea\u306e\u30a2\u30a4\u30b3\u30f3\u3092\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3 \u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u30c9\u30e9\u30c3\u30b0 \u30a2\u30f3\u30c9 \u30c9\u30ed\u30c3\u30d7\u3057\u307e\u3059\u304c\u3001\u30de\u30cb\u30a2\u306f\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u307e\u305f\u3001\u3044\u304f\u3064\u304b\u306e\u70b9\u306b\u7559\u610f\u3059\u308c\u3070\u3001Mac \u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u7c21\u5358\u306b\u5b9f\u884c\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u307e\u305a\u3001\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u3001\u4f55\u304c\u3067\u304d\u308b\u306e\u304b\u3092\u77e5\u3089\u305a\u306b\u5b9f\u884c\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u7c21\u5358\u306a\u65b9\u6cd5\u3068\u5b89\u5168\u306a\u65b9\u6cd5\u306e 2 \u3064\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002 \u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u3064\u3044\u3066\u77e5\u3063\u3066\u304a\u304f\u3079\u304d\u3053\u3068 \u30b7\u30a7\u30eb\u306f\u3001\u30b3\u30de\u30f3\u30c9\u3067\u4f7f\u7528\u3067\u304d\u308b\u5bfe\u8a71\u578b\u306e\u30c6\u30ad\u30b9\u30c8\u30d9\u30fc\u30b9\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3067\u3059\u3002\u3064\u307e\u308a\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306f\u3001\u7e70\u308a\u8fd4\u3057\u306e\u30bf\u30b9\u30af\u3067\u30b3\u30de\u30f3\u30c9\u3092\u518d\u5165\u529b\u3059\u308b\u624b\u9593\u3092\u7701\u304f\u305f\u3081\u306b\u3001\u8907\u6570\u306e\u30b3\u30de\u30f3\u30c9\u3092\u542b\u3080\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3059\u3002\u3053\u306e\u3088\u3046\u306b\u3057\u3066\u3001\u8907\u6570\u306e\u30bf\u30b9\u30af\u3092 1 \u3064\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u307e\u3068\u3081\u3001\u6642\u9593\u3092\u7bc0\u7d04\u3057\u3001\u7e70\u308a\u8fd4\u3057\u306e\u30bf\u30b9\u30af\u3067\u767a\u751f\u3059\u308b\u30a8\u30e9\u30fc\u3092\u56de\u907f\u3067\u304d\u307e\u3059\u3002\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u306f\u3001SH \u62e1\u5f35\u5b50\u304c\u4ed8\u304d\u307e\u3059\u3002 \u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u57fa\u672c\u306b\u3064\u3044\u3066\u306f\u3053\u308c\u4ee5\u4e0a\u8aac\u660e\u3057\u307e\u305b\u3093\u3002Mac \u3067\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u3073\u305f\u3044\u5834\u5408\u306f\u3001Apple \u306e\u516c\u5f0f Shell Scripting Primer\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3068\u306f\u3044\u3048\u3001\u982d\u3092\u60a9\u307e\u305b\u305f\u308a\u5fc3\u914d\u3057\u305f\u308a\u3057\u306a\u3044\u305f\u3081\u306b\u306f\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u95a2\u3059\u308b 2 \u3064\u306e\u898f\u5247\u3092\u899a\u3048\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 1. \u6a29\u9650\u3092\u76f2\u76ee\u7684\u306b\u4ed8\u4e0e\u3059\u308b\u3068\u9006\u52b9\u679c\u306b\u306a\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u2013 \u901a\u5e38\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u306e\u306b\u30eb\u30fc\u30c8 \u30e6\u30fc\u30b6\u30fc (\u7ba1\u7406\u8005\u30ec\u30d9\u30eb\u306e\u6a29\u9650) \u306f\u5fc5\u8981\u3042\u308a\u307e\u305b\u3093\u3002\u305f\u3060\u3057\u3001\u9078\u629e\u3057\u305f\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b sudo \u30e6\u30fc\u30b6\u30fc (\u7ba1\u7406\u8005) \u6a29\u9650\u304c\u5fc5\u8981\u306a\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u306b\u306f\u3001\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u5b8c\u5168\u306a\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u524d\u306b\u3001\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5185\u5bb9\u3068\u30bd\u30fc\u30b9\u3092\u518d\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3092\u5f37\u304f\u304a\u52e7\u3081\u3057\u307e\u3059\u3002 \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u5bfe\u7b56\u3068\u3057\u3066\u3001macOS \u3067\u306f\u3001\u30b7\u30b9\u30c6\u30e0 \u30d5\u30a9\u30eb\u30c0\u30fc\u304b\u3089\u30eb\u30fc\u30c8\u6a29\u9650\u3092\u5fc5\u8981\u3068\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u6a29\u9650\u304c\u4ed8\u4e0e\u3055\u308c\u307e\u305b\u3093\u3002 2. \u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5185\u5bb9\u3092\u78ba\u8a8d\u3059\u308b\u2013 Sublime Text \u306a\u3069\u306e\u30c6\u30ad\u30b9\u30c8 \u30a8\u30c7\u30a3\u30bf\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3001\u4ed6\u306e\u5834\u6240\u304b\u3089\u53d6\u5f97\u3057\u305f\u30b7\u30a7\u30eb \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8868\u793a\u3057\u305f\u308a\u3001\u65b0\u3057\u3044\u30b7\u30a7\u30eb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[23,203,204],"class_list":["post-1736","post","type-post","status-publish","format-standard","hentry","category-how-to","tag-macos","tag-programming","tag-shell-script"],"acf":[],"_links":{"self":[{"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/posts\/1736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/comments?post=1736"}],"version-history":[{"count":1,"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/posts\/1736\/revisions"}],"predecessor-version":[{"id":1737,"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/posts\/1736\/revisions\/1737"}],"wp:attachment":[{"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/media?parent=1736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/categories?post=1736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howtogeek.blog\/ja\/wp-json\/wp\/v2\/tags?post=1736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}