<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B</id>
	<title>Xamarin.Macで管理者権限に昇格してコマンド実行する - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B"/>
	<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;action=history"/>
	<updated>2026-06-06T16:57:56Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7225&amp;oldid=prev</id>
		<title>imported&gt;Administrator: Administrator がページ「Xamarin.Mac/管理者権限に昇格して実行する」を「Xamarin.Macで管理者権限に昇格してコマンド実行する」に移動しました</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7225&amp;oldid=prev"/>
		<updated>2018-07-27T06:50:11Z</updated>

		<summary type="html">&lt;p&gt;Administrator がページ「&lt;a href=&quot;/wiki/Xamarin.Mac/%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&quot; class=&quot;mw-redirect&quot; title=&quot;Xamarin.Mac/管理者権限に昇格して実行する&quot;&gt;Xamarin.Mac/管理者権限に昇格して実行する&lt;/a&gt;」を「&lt;a href=&quot;/wiki/Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&quot; title=&quot;Xamarin.Macで管理者権限に昇格してコマンド実行する&quot;&gt;Xamarin.Macで管理者権限に昇格してコマンド実行する&lt;/a&gt;」に移動しました&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2018年7月27日 (金) 06:50時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>imported&gt;Administrator</name></author>
	</entry>
	<entry>
		<id>https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7224&amp;oldid=prev</id>
		<title>108.162.226.154: /* 注意2 */</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7224&amp;oldid=prev"/>
		<updated>2016-11-16T05:14:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;注意2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2016年11月16日 (水) 05:14時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l43&quot;&gt;43行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;43行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===注意2 ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;===注意2 ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;また、[[アップル]]&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;の公式ドキュメントによると管理者権限に昇格して直接的に危険な操作をすることは推奨されておらず、管理者権限が不必要な部分と管理者権限が必要な部分で&lt;/del&gt;[[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;プログラム&lt;/del&gt;]]&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;を分離させて、&lt;/del&gt;[[プロセス間通信]]をすることが推奨されている。つまりこの実装は手抜きで楽であるが世間様にオススメできるようなものではない。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;また、[[アップル]]&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;の公式ドキュメントによると１つのアプリが管理者権限に昇格して直接的に危険な操作をすることは推奨されておらず、管理者権限が不必要な部分と、管理者権限が必要な部分で&lt;/ins&gt;[[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;アプリ&lt;/ins&gt;]]&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;を２つに分離させて、&lt;/ins&gt;[[プロセス間通信]]をすることが推奨されている。つまりこの実装は手抜きで楽であるが世間様にオススメできるようなものではない。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==関連項目==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==関連項目==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>108.162.226.154</name></author>
	</entry>
	<entry>
		<id>https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7223&amp;oldid=prev</id>
		<title>221.188.74.218: /* 実装1：ExecuteWithPrivileges */</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7223&amp;oldid=prev"/>
		<updated>2015-07-06T02:30:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;実装1：ExecuteWithPrivileges&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2015年7月6日 (月) 02:30時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l28&quot;&gt;28行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;28行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             using (var auth = Authorization.Create(defaults))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             using (var auth = Authorization.Create(defaults))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;             {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 // &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ExecuteWithPrivilegesメソッドを呼ぶと認証ダイアログが出る&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 // &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ExecuteWithPrivilegesメソッドを呼ぶと認証ダイアログが表示される。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 var args = new[]{&amp;quot;-c&amp;quot;, &amp;quot;\&amp;quot;\&amp;quot;mkdir -p /usr/share/MyFolder\&amp;quot;\&amp;quot;&amp;quot;};&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 var args = new[]{&amp;quot;-c&amp;quot;, &amp;quot;\&amp;quot;\&amp;quot;mkdir -p /usr/share/MyFolder\&amp;quot;\&amp;quot;&amp;quot;};&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 var ret = (AuthorizationStatus)auth.ExecuteWithPrivileges(&amp;quot;/bin/sh&amp;quot;, defaults, args);&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;                 var ret = (AuthorizationStatus)auth.ExecuteWithPrivileges(&amp;quot;/bin/sh&amp;quot;, defaults, args);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>221.188.74.218</name></author>
	</entry>
	<entry>
		<id>https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7222&amp;oldid=prev</id>
		<title>221.188.74.218: ページの作成:「Mac OS Xのアプリは通常は一般権限で実行されるが、システムファイルの操作など管理者権限に昇格して危険な操作をしたい...」</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Xamarin.Mac%E3%81%A7%E7%AE%A1%E7%90%86%E8%80%85%E6%A8%A9%E9%99%90%E3%81%AB%E6%98%87%E6%A0%BC%E3%81%97%E3%81%A6%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B&amp;diff=7222&amp;oldid=prev"/>
		<updated>2015-07-06T02:29:04Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「&lt;a href=&quot;/wiki/Mac_OS_X&quot; title=&quot;Mac OS X&quot;&gt;Mac OS X&lt;/a&gt;のアプリは通常は一般権限で実行されるが、システムファイルの操作など管理者権限に昇格して危険な操作をしたい...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Mac OS X]]のアプリは通常は一般権限で実行されるが、システムファイルの操作など管理者権限に昇格して危険な操作をしたいこともある。&lt;br /&gt;
&lt;br /&gt;
==実装1：ExecuteWithPrivileges ==&lt;br /&gt;
Security名前空間のAuthorizationクラスにExecuteWithPrivilegesメソッドという恐ろしいものが用意されている。&lt;br /&gt;
認証が成功した場合は[[root権限]]で実行されので取り扱いには細心の注意を必要とする。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using AppKit;&lt;br /&gt;
using Security;&lt;br /&gt;
&lt;br /&gt;
namespace Auth&lt;br /&gt;
{&lt;br /&gt;
    static class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            NSApplication.Init();&lt;br /&gt;
&lt;br /&gt;
            var ret = Auth();&lt;br /&gt;
            Console.WriteLine(ret);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        static AuthorizationStatus Auth()&lt;br /&gt;
        {&lt;br /&gt;
            var defaults = AuthorizationFlags.Defaults;&lt;br /&gt;
&lt;br /&gt;
            using (var auth = Authorization.Create(defaults))&lt;br /&gt;
            {&lt;br /&gt;
                // ExecuteWithPrivilegesメソッドを呼ぶと認証ダイアログが出る&lt;br /&gt;
                var args = new[]{&amp;quot;-c&amp;quot;, &amp;quot;\&amp;quot;\&amp;quot;mkdir -p /usr/share/MyFolder\&amp;quot;\&amp;quot;&amp;quot;};&lt;br /&gt;
                var ret = (AuthorizationStatus)auth.ExecuteWithPrivileges(&amp;quot;/bin/sh&amp;quot;, defaults, args);&lt;br /&gt;
                return ret;&lt;br /&gt;
            }  &lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===注意1 ===&lt;br /&gt;
この[[プログラム]]を実行すると「/usr/share/MyFolder」というゴミディレクトリが[[root権限]]で生成されるので注意しよう。&lt;br /&gt;
[[root権限]]や[[sudo]]の意味がわからない者にはオススメできない。&lt;br /&gt;
&lt;br /&gt;
===注意2 ===&lt;br /&gt;
また、[[アップル]]の公式ドキュメントによると管理者権限に昇格して直接的に危険な操作をすることは推奨されておらず、管理者権限が不必要な部分と管理者権限が必要な部分で[[プログラム]]を分離させて、[[プロセス間通信]]をすることが推奨されている。つまりこの実装は手抜きで楽であるが世間様にオススメできるようなものではない。&lt;br /&gt;
&lt;br /&gt;
==関連項目==&lt;br /&gt;
*[[Xamarin.Mac/AppleScriptを実行する]]&lt;br /&gt;
*[[Xamarin.Mac/スクリーンセーバーを終了させる]]&lt;br /&gt;
&lt;br /&gt;
==参考文献==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
{{stub}}&lt;br /&gt;
&lt;br /&gt;
[[category:Xamarin.Mac]]&lt;/div&gt;</summary>
		<author><name>221.188.74.218</name></author>
	</entry>
</feed>